Posts: 76
how to display links inside my rss description?
hey all,
I have that in my rxml:
xml.instruct!
xml.rss "version" => "2.0", "xmlns:dc" =>
"http://purl.org/dc/elements/1.1/" do
xml.channel do
xml.title _(''My RSS'')
xml.link url_for(:only_path=> false,
:controller=>''authors'',
:action => ''list'')
xml.pubDate CGI.rfc1123_date(@items.first.updated_at)
xml.description _("feed of the day")
@items.each do |item|
xml.item do
xml.title item.title
xml.link url_for(:only_path => false,
:controller => ''items'',
:action => ''show'',
:id => list)
xml.description item.authors.collect do |author|
link_to(author.name,:only_path => false,
:controller => ''items'',
:action => ''show'',
:id => item.id)
end
xml.pubDate CGI.rfc1123_date(list.updated_at)
xml.guid url_for(:only_path => false,
:controller => ''items'',
:action => ''show'',
:id => item)
xml.author h("no one")
end
end
end
end
but then i get that error:
XmlMarkup cannot mix a text argument with a block
Extracted source (around line #18):
15: :controller => ''items'',
16: :action => ''show'',
17: :id => list)
18: xml.description item.authors.collect do |author|
19: link_to(author.name,:only_path => false,
20: :controller => ''items'',
21: :action => ''show'',
22: :id => item.id)
any idea how I should do this?
Thanx in advance
Pat
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---
Patrick Aljord wrote:> Posts: 76 > how to display links inside my rss description?It doesn''t look like you''re having trouble with any links... looks like Builder doesn''t like you calling a block as an argument to a tag (via method_missing):> xml.description item.authors.collect do |author| > link_to(author.name,:only_path => false, > :controller => ''items'', > :action => ''show'', > :id => item.id) > > endI think you want braces around the content (the block) being passed to xml.description: xml.description { item.authors.collect do |author| link_to(author.name,:only_path => false, :controller => ''items'', :action => ''show'', :id => item.id) end } Looks to me like you also have some typos in there, unless they''re features of Builder of which I''m not aware... in particular there is a ''_'' character before a ''('' in two places: xml.title _(''My RSS'') and xml.description _("feed of the day") Good luck b> xml.pubDate CGI.rfc1123_date(list.updated_at) > xml.guid url_for(:only_path => false, > :controller => ''items'', > :action => ''show'', > :id => item) > xml.author h("no one") > end > end > end > end > > but then i get that error: > XmlMarkup cannot mix a text argument with a block > > Extracted source (around line #18): > > 15: :controller => ''items'', > 16: :action => ''show'', > 17: :id => list) > 18: xml.description item.authors.collect do |author| > 19: link_to(author.name,:only_path => false, > 20: :controller => ''items'', > 21: :action => ''show'', > 22: :id => item.id) > > any idea how I should do this? > > Thanx in advance > > Pat > > > >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
On 17-Feb-07, at 2:08 AM, Ben Munat wrote:> > Patrick Aljord wrote: >> Posts: 76 >> how to display links inside my rss description? >sorry - just noticed this thread. this thread will show you how to use resource_feeder (render_rss_feed_for) to render regular old rhtml views for rss/atom descriptions. http://groups.google.com/group/rubyonrails-talk/browse_thread/thread/ 2b920da418dc9363/beec22ed5fa26fea?lnk=gst&q=&rnum=13#beec22ed5fa26fea Cheers, Jodi General Partner The nNovation Group inc. www.nnovation.ca/blog --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
thanx a lot. On 2/17/07, Ben Munat <bmunat-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Looks to me like you also have some typos in there, unless they''re > features of Builder of which I''m not aware... in particular there is a > ''_'' character before a ''('' in two places: > > xml.title _(''My RSS'') > > and > > xml.description _("feed of the day") >this is not a typo, it''s just ruby gettext synthax :) --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Patrick Aljord wrote:> thanx a lot. > > On 2/17/07, Ben Munat <bmunat-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: >> Looks to me like you also have some typos in there, unless they''re >> features of Builder of which I''m not aware... in particular there is a >> ''_'' character before a ''('' in two places: >> >> xml.title _(''My RSS'') >> >> and >> >> xml.description _("feed of the day") >> > this is not a typo, it''s just ruby gettext synthax :)Ah, cool... so I taught you something and you taught me something! :-) b --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---