Just do for comment in recipe.comments.  Instead of loading all the
comments, do an :include => :comments on your recipes find.  I assume
you want your comments grouped with your recipes.

On Aug 17, 5:14 am, Raghu M <[email protected]> wrote:
> I did the changes like this
>
> Recipe Controller:
> =============
>   def rss
>     @recipes = Recipe.find(:all)
>     @comments = Comment.find(:all)
>   end
>
> index.rss.builder:
> ==============
> xml.instruct! :xml, :version =>"1.0"
>
> xml.rss :version =>"2.0" do
>  xml.channel do
>
>    xml.title "Hobo Cookbook"
>    xml.link formatted_recipes_url
>    xml.description "Hobo Cookbook"
>
>    for recipe in @recipes
>      xml.item do
>        xml.title recipe.name
>        xml.description recipe.body
>        xml.link formatted_recipe_url(recipe, :rss)
>        for comment in @comments
>           xml.item do
>              xml.title comment.body
>           end
>        end
>
>      end
>    end
>
>  end
> end
>
> It doesn't work ... it throws an error at "for comment in @comments".
>
> Am i correct in my interpretation? Have i done any mistake? Sorry about all
> these questions .... I am a complete newbie to rails and hobo.
>
> Thanks & Regards
> Raghu M
>
> On Fri, Aug 14, 2009 at 3:19 AM, kevinpfromnm <[email protected]>wrote:
>
>
>
> > Include the comments on your recipes find and loop through the
> > comments in your for recipe in @recipes loop.
>
> > On Aug 12, 10:33 pm, Raghu M <[email protected]> wrote:
> > > Hi kevin,
>
> > > Thanks for the idea. Tried it .. but, it doesn't work :(
>
> > >  Let me explain, how i did RSS for recipe. it will be easier to
> > understand,
> > > what i want
>
> > > Added the following method to recipes_controller
>
> > >   def rss
> > >     @recipes = Recipe.find(:all)
> > >   end
>
> > > Added the file index.rss.builder to views/recipes. The file contains the
> > > following code
>
> > > xml.instruct! :xml, :version =>"1.0"
>
> > > xml.rss :version =>"2.0" do
> > >  xml.channel do
>
> > >    xml.title "Hobo Cookbook"
> > >    xml.link formatted_recipes_url
> > >    xml.description "Hobo Cookbook"
>
> > >    for recipe in @recipes
> > >      xml.item do
> > >        xml.title recipe.name
> > >        xml.description recipe.body
> > >        xml.link formatted_recipe_url(recipe, :rss)
> > >      end
> > >    end
>
> > >  end
> > > end
>
> > > And made the RSS feed visible, by adding the following line to
> > index.dryml
> > > of recipes
>
> > > <p><%= link_to "RSS Feed", formatted_recipes_url(:rss) %></p>
>
> > > Now, this gives me a list of recipes in the RSS feed. What i want is "the
> > > comments for each recipe to be displayed as well".
>
> > > How do i go about it?
>
> > > Thanks & Regards
> > > Raghu M
>
> > > On Thu, Aug 13, 2009 at 4:23 AM, kevinpfromnm <[email protected]
> > >wrote:
>
> > > > Instead of creating routes, maybe just add an index_action :rss under
> > > > the comment controller.  Or are you looking for comments for a
> > > > particular recipe?
>
> > > > On Aug 11, 11:49 pm, "Raghu. M" <[email protected]> wrote:
> > > > > Hi,
>
> > > > > I am trying to create RSS feeds for the Cookbook. I was able to
> > create
> > > > > RSS feeds for Recipes ... what i want is the new comments to be
> > > > > available on the RSS feed. But, i am unable to create feeds for
> > > > > comments. Not sure how to create routes for that.
>
> > > > > Can anyone help me, please?
>
> > > > > Thanks & Regards
> > > > > Raghu M
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Hobo 
Users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/hobousers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to