Skip to content

Instantly share code, notes, and snippets.

@veezus
Forked from sandro/idiomatic_throw_catch?.rb
Created July 18, 2011 22:08
Show Gist options
  • Save veezus/1090806 to your computer and use it in GitHub Desktop.
Save veezus/1090806 to your computer and use it in GitHub Desktop.
def update_main_artist
artist = artists.first
if rovi_artist
artist = Artist.create(:name => rovi_artist.name)
end
update_attribute :main_artist_id, artist.id
end
def update_main_artist
if rovi_artist
artist = Artist.create(:name => rovi_artist.name)
else
artist = artists.first
end
update_attribute :main_artist_id, artist.id
end
def update_main_artist
artist = catch(:artist) do
if rovi_artist
throw(:artist, Artist.create(:name => rovi_artist.name))
end
artists.first
end
update_attribute :main_artist_id, artist.id
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment