简体   繁体   English

如何使用feedjira来实现Rails应用程序的RSS提要

[英]How to implement an rss feed to a rails application using feedjira

I want to firstly apologize for asking a very similar question to ones that already exist. 首先,我想问一个与已经存在的问题非常相似的问题。 However, I couldn't quite find the thread and answers I was looking for. 但是,我找不到所需的主题和答案。

Everywhere I research about implementing an rss feed to a rails application it's in the context of doing the implementation for a blog. 我到处研究有关在Rails应用程序中实现rss feed的情况,这是在博客实现中进行的。 I would greatly appreciate any help in learning how to do this outside of this context. 我将不胜感激,在此背景之外的学习方法方面有任何帮助。 I have some ruby experience (mainly writing rspec based test cases) but I have little to no experience using rails and even less web development experience in general. 我有一些红宝石经验(主要是编写基于rspec的测试用例),但是我几乎没有使用过Rails的经验,甚至没有Web开发的经验。

I would just like to implement the feed on the index page of my rails app. 我只想在Rails应用程序的索引页面上实现提要。 If anyone decides to tackle this question I would appreciate a very step by step tutorial...very granular. 如果有人决定解决这个问题,我将非常感谢您提供逐步的教程...非常详细。

Ended up using the simple-rss and open-uri gems. 最终使用了simple-rss和open-uri宝石。 I created a helper method in my pages controller: 我在页面控制器中创建了一个辅助方法:

def feed
  require 'simple-rss'
  require 'open-uri'

  @rss = SimpleRSS.parse open('http://url_goes_here')
  @rss = @rss.items
end

That's the base method. 这是基本方法。 I would recommend windows users of rails to really give simple-rss a shot. 我建议Windows用户使用Rails来真正给Simple-RSS一炮而红。 I was trying to get the feedjira gem to install and never had any luck. 我试图安装feedjira宝石,却没有任何运气。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM