I am creating a XML file of image urls, and I have to parse this URL when I am writing out the XML.
Some rows in the database don’t have a URL, so how do I skip those rows and don’t process?
Something like:
images = Image.limit(100)
images.each { |i|
blah = ''
if i.url ???
# process stuff here
else
blah = ''
end
}
If it’s a SQL database, I’d use a query that skipped rows with missing URLs:
or something similar to that. Database queries differ depending on the database.
Otherwise, in Ruby I’d do something like:
or: