Rails Resource Feeder Fun

I had my first chance to use the new resource feeder yesterday while working on Tesly Jr. (yet to be announced product — contact me to learn more if you're interested), and I thought I'd write up a quick example of how it's used. The disclaimer to this post is that the resource feeder plugin is still quite new, and this example could become obsolete at any time.

There's already a blog post about using this plugin, but I wanted to show something else — an answer to a question I'm sure will pop up again and again in #rubyonrails when people start really using this plugin: how do you customize the contents of the feed with multiple attributes from the model? It's as simple as passing a proc in to the feeder:

class TestRunsController < ApplicationController def feed render_atom_feed_for TestRun.find(:all, :include => :test_plans, :order => 'test_runs.created_at desc', :limit => 50), :item => { :title => 'Test run execution', :description => Proc.new {|r| "Executed test plans: #{r.test_plan_names}

\n\nPass percentage: #{r.percentage.round}%" } } end end

Comments