How to display links inside my rss description?

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” =>
DCMI: DCMI Metadata Terms” 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

Patrick A. 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)

end

I 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

On 17-Feb-07, at 2:08 AM, Ben M. wrote:

Patrick A. 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

Patrick A. wrote:

xml.description _(“feed of the day”)

this is not a typo, it’s just ruby gettext synthax :slight_smile:

Ah, cool… so I taught you something and you taught me something! :slight_smile:

b

thanx a lot.

On 2/17/07, Ben M. [email protected] 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 :slight_smile: