Hi all,
I have a bit of a problem and don''t know how to proceed:
I have the following RXML Template that:
---------------------------------------
xml.instruct!
xml.articles do
for article in @articles
xml.article do
xml.id(article.id, :type => ''integer'')
xml.created_at(article.created_at.xmlschema, :type =>
''datetime'')
xml.title(article.title)
xml.author do
xml.id(author.id, :type => ''integer'')
xml.first_name(author.first_name)
xml.last_name(author.last_name)
end
end
end
end
---------------------------------------
Some articles have an author and some do not. In this case I get an
error complaining about author being null when accessing author.id.
I can''t figure out how to conditionally include the author tag in the
XML only if article.author is not nil.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---