-
Website
http://paulmwatson.com/journal -
Original page
http://paulmwatson.com/journal/2006/05/10/a-dirty-ruby/ -
Subscribe
All Comments -
Community
-
Top Commenters
-
aidanf
1 comment · 3 points
-
keithbohanna
1 comment · 1 points
-
martinmurphy
1 comment · 1 points
-
jufemaiz
1 comment · 1 points
-
lxsg
1 comment · 1 points
-
-
Popular Threads
if soapResponse.getNewTagsSinceResult.respond_to? "tag"
for tag in soapResponse.getNewTagsSinceResult.tag.to_a
@tag = Tag.find_by_sync_id(tag.id)
if (@tag)
@tag.name = tag.name
@tag.save
else
@tag = Tag.new
@tag.name = tag.name
@tag.sync_id = tag.id
@tag.save
end
end
end
Just a quick warning that currently all objects respond to to_a but this will soon be deprecated so for future versions it's better to check that the tag object class explicity implements to_a.
@tag = Tag.find_by_syn_id(tag.id) || Tag.new
@tag.name = tag.name
@tag.sync_id ||= tag.id
@tag.save
if soapResponse.getNewTagsSinceResult.respond_to? "tag" for tag_current in Array(soapResponse.getNewTagsSinceResult.tag)
tag = Tag.find_by_sync_id(tag_current.id) || Tag.new
tag.name = tag_current.name
tag.sync_id = tag_current.id
tag.save
end
end
Thanks Farrel.