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 -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
David Smit 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 helpSaying 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. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
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 -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
David Smit 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 replyingI 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. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Thanks, that works. And yes DRY is good. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---