Build a RSS feed in Ruby on Rails : Lugo Labs

Building a RSS feed in Ruby on Rails is very easy, it feels like almost built in. We'll use the XML Builder handler that comes with Rails, so let's get started.

Let's assume we want to add the feed to our company blog, made of Article models. Each article has a title and a body property. The ArticlesController is a normal CRUD Rails controller; we'll add the feed to the index action, so let's update that now:

ruby

# app/controllers/articles_controller.rb class ArticlesController < ApplicationController def index @articles = Article.last(10) respond_to do |format| format.html format.rss { render :layout => false } end end end

The code above just removes the...

Read more


Website: http://www.lugolabs.com

Related topics : rails rss feed builder / rails rss feed reader / rails rss feed / rss feed reader code html / ruby on rails rss reader

Create a valid RSS feed in Rails - makandropedia

Create a valid RSS feed in Rails

This will show you how to create a RSS feed that the Feed Validator considers valid.

Note that RSS is a poorly specified format. Consider using the Atom builder to make an Atom feed instead. Write a note here if you do.

Controller

Create a FeedsController to host the RSS feed. Such a controller is also useful to host other data feeds that tend to gather over the...

Read more


Website: https://makandracards.com

Related topics : rails rss feed builder / rails rss feed / rss feed software free / rss feed software