Feed.Us and Ruby on Rails
Feed.Us is a content management application.
Use Feed.Us to managing copy, text and media on a site or within a web app, without having to edit code. It's best used for non-technical people to make changes without bothering a developer.
Feed.Us works on a variety of platforms/technologies. The most common is Php. But second, and fastest growing, is Rails.
How does Feed.Us works with Rails?
The Rails grabber conceptually works the same as the way Feed.Us works with Php, in that you place some code on your server and it will either grab the content from the Feed.Us servers or from the local cache.
But, the Rails grabber consists of more than one file - it actually consists of several files and directories.
Rails applications follow the MVC pattern, Model, View, Controller. This pattern separates code files into logical groups (to make the application easier to maintain).
To align with this paradigm, the Rails grabber consists of multiple files. To make obtaining and using the Rails grabber easier, we have packaged the grabber as a gem "feed_us_grabber" and have made it available on rubygems.org at http://rubygems.org/gems/feed_us_grabber
In this video, Feed.Us's Cliff Gray runs through setting up a Rails application to work with Feed.Us. It's 11 minutes long.
Scroll down below the video for a short, text description.
To use the Rails grabber, you use our Scriptomatic page in the same way you would for Php, but select "Ruby on Rails 3.x" of Here's a view of our Scriptomatic, in the "Export" section on Feed.Us:
Once you install the feed_us_grabber gem, there is a README file in the root directory that explains how to use the feed_us_grabber for rails.
1. In your rails application, edit your Gemfile to include: gem ‘feed_us_grabber’.
2. Run bundle install from the command line (this will download the feed_us_grabber to your environment).
3. Open config/routes.rb and add following line: match “rails_app/FeedUsGrabber” => “FeedUsGrabber#index” ** where rails_app is the root URL to your application. The match is case sensitive.
4. Update environment.rb and include require ‘net/http’ .
5. Your installation is complete.
Once installed, you can then use the grabber in your site:
1. Add following line to each controller (or app/controllers/application_controller.rb): include FeedUsGrabberHelper
2. Add following code inside your controllers actions: @grabber = feedUsGrabber(:FeedUsURL => ‘<FEED.US URL>’,:FeedUsCacheInterval => FEED_INTERVAL, :FeedUsCacheIntervalLength => FEED_INTERVAL_LENGTH, :FeedUsCacheGroup => ‘FEED CACHE GROUP NAME’)
3. Inside the view of the action add the following code to render your content <%= feedUsGrabberRender @grabber %>
4. Get the specific Feed.US URL from our site:
Example index.erb of “test” looks like
<%= feedUsGrabberRender @grabber %>
If comparing to Php, essentially you get the grabber from our "Scriptomatic", install the necessary file(s) in your application, and then for Rails, you modify three files (routes.rb, the Controller, and the View).
Does this help? We hope so. Please let us know!