RSS and file_column

Hi,

I am trying to add a description and a picture from file_column to an
RSS feed. Any idea how I can do this?

The code that doesn’t work:
xml.description advert.description + image_tag
url_for_file_column(advert, “image”,“thumb”) unless
url_for_file_column(advert, “image”,“thumb”).nil?)

Please help

David S. wrote:

Hi,

I am trying to add a description and a picture from file_column to an
RSS feed. Any idea how I can do this?

The code that doesn’t work:
xml.description advert.description + image_tag
url_for_file_column(advert, “image”,“thumb”) unless
url_for_file_column(advert, “image”,“thumb”).nil?)

Please help

Saying that it “doesn’t work” never gives us enough info to help you.

What about the expected result and the actual result. If you are
getting an error be sure to say what the error is.

Sorry about giving a bad description.

This is the error I get:
SyntaxError in Front#feed

Showing app/views/front/feed.rxml where line #17 raised:

compile error
./script/…/config/…/app/views/front/feed.rxml:17: parse error,
unexpected tIDENTIFIER, expecting kDO or ‘{’ or ‘(’
xml.description advert.description + image_tag
url_for_file_column(advert, “image”,“thumb”) unless
url_for_file_column(advert, “image”,“thumb”).nil?

All I want to do is have advert.description and the image in the
description field of the rss feed.

Thanks for replying

David S. wrote:

Sorry about giving a bad description.

This is the error I get:
SyntaxError in Front#feed

Showing app/views/front/feed.rxml where line #17 raised:

compile error
./script/…/config/…/app/views/front/feed.rxml:17: parse error,
unexpected tIDENTIFIER, expecting kDO or ‘{’ or ‘(’
xml.description advert.description + image_tag
url_for_file_column(advert, “image”,“thumb”) unless
url_for_file_column(advert, “image”,“thumb”).nil?

All I want to do is have advert.description and the image in the
description field of the rss feed.

Thanks for replying

I think you are confusing ruby with your lack of ()'s. You are
stringing multiple method calls with arguments together and ruby cant
tell what’s a method and what’s an argument.

I would write something like this:

if file_url = url_for_file_column(…)
xml.description(advert.description + image_tag(file_url))
end

As a bonus you only call url_for_file_column once. Keeping it a bit
DRYer.

Thanks, that works. And yes DRY is good.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs