Greetings all.
This topic is not a question, but a ''how do I do that''.
If you''ve had the chance to use the rails resource_feeder plugin,
you''ll love the ease with which rss/atom feeds can be rendered.
My grief came when I tried to juice up my rss/atom descriptions with
some sweet html, and came under the impression that item descriptions
were limited to the a single designated attribute on your model, so I
set out to improve resource_feeder to permit descriptions to be
specified by rendering a view...
turns out my assumption was wrong, and you can render a view using a
Proc and render_to_string as follows:
for plain text descriptions,
:description => Proc.new {|o| render_to_string(:partial =>
''show_text'', :locals => {:object => o, :fred =>
fred}) }
and for html descriptions,
:content_encoded => Proc.new {|o| render_to_string(:partial =>
''show_html'', :locals => {:object => o, :fred =>
fred}) }
that''s it - now your rss/atom descriptions will be rendered from the
partial ''show''. Just remember to use render_to_string
otherwise
you''ll get a DoubleRender exception.
note: in order to use resource_feeder and the latest simply_helpful,
you''ll have to manually [1]patch resource_feeder to match new
simply_helpful packaging.
[1] http://dev.rubyonrails.org/ticket/7468
"One last thing" - if you''re feeding a nested resource, you
may have
to use the link option - I couldn''t get nested routes to work and
had to specify the option link as :
:link => Proc.new {|o| object_url(master_object_objectt.id, o.id)},
that''s it - happy feeding all, and thanx to team-core for the Proc
interface.
Jodi
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---