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.