Skip to content

Instantly share code, notes, and snippets.

@texel
Created September 22, 2009 18:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save texel/191269 to your computer and use it in GitHub Desktop.
Save texel/191269 to your computer and use it in GitHub Desktop.
foo, bar = nil, nil
begin
transaction do
foo = FooClass.create!(:blah => 'blah')
bar = BarClass.create!(:bleh => 'bleh')
return foo, bar, 'success'
end
rescue ActiveRecord::RecordInvalid => e
return foo, bar, 'error'
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment