No commit activity in last 3 years
No release in over 3 years
Rails helpers for feedbuilder
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

 Project Readme

Helpers that integrate feedbuilder into Rails.

Usage

require 'feedbuilder-rails'
require 'will_paginate' # to get paging links

FeedBuilder.feed_id_domain = 'maz.org'

class Nug < ActiveRecord::Base
  acts_as_feed_provider

  def entry_title
    name # a persistent attribute
  end

  def entry_summary
    Atom::Content::Text.new("A nug named #{name}")
  end

  def entry_content
    Atom::Content::Html.new("<p>A nug named #{name}</p>")
  end
end

class NugsController < ApplicationController
  def index
    respond_to do |format|
      format.atom do
        nugs = Nug.paginate(:page => (params[:page] || 1), :page_size => (params[:page_size] || 10))
        send_feed("nugs.atom", :etag => nugs) do
          url_builder = feed_url_builder(root_url, nugs_url)
          options = {:feed_title => "Bucket o' nugs", :feed_id_path => nugs_path}
          Nug.build_feed(nugs, url_builder, options) do |nug, entry|
             entry.id = Nug.feed_tag_uri(nug_path(nug), :date => nug.created_at)
             entry.links << Atom::Link.new(:href => nug_url(nug), :rel => :alternate, :type => 'text/html')
          end
        end
      end
    end
  end
end

To do

  • Provide a custom renderer

Copyright

Copyright (c) 2010 Brian Moseley. See LICENSE for details.