# RSS and file\_column

**URL:** <https://www.ruby-forum.com/t/rss-and-file-column/76458>\
**Category:** Rails\
**Created:** [November 19, 2006, 4:39am UTC](https://www.ruby-forum.com/t/rss-and-file-column/76458 "2006-11-19T04:39:16Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![davidstokar](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/4da419/32.png) [@davidstokar](https://www.ruby-forum.com/u/davidstokar)\
**Post date:** [November 19, 2006, 4:39am UTC](https://www.ruby-forum.com/t/rss-and-file-column/76458/1 "2006-11-19T04:39:16Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![davidstokar](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/4da419/32.png) [@davidstokar](https://www.ruby-forum.com/u/davidstokar)\
**Post date:** [November 19, 2006, 5:24am UTC](https://www.ruby-forum.com/t/rss-and-file-column/76458/2 "2006-11-19T05:24:16Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![davidstokar](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/4da419/32.png) [@davidstokar](https://www.ruby-forum.com/u/davidstokar)\
**Post date:** [November 19, 2006, 5:31am UTC](https://www.ruby-forum.com/t/rss-and-file-column/76458/3 "2006-11-19T05:31:42Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![davidstokar](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/4da419/32.png) [@davidstokar](https://www.ruby-forum.com/u/davidstokar)\
**Post date:** [November 19, 2006, 5:56am UTC](https://www.ruby-forum.com/t/rss-and-file-column/76458/4 "2006-11-19T05:56:24Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![davidstokar](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/4da419/32.png) [@davidstokar](https://www.ruby-forum.com/u/davidstokar)\
**Post date:** [November 19, 2006, 8:19am UTC](https://www.ruby-forum.com/t/rss-and-file-column/76458/5 "2006-11-19T08:19:11Z")

</div>

Thanks, that works. And yes DRY is good.
