Skip to content

Instantly share code, notes, and snippets.

@pvin
Created November 11, 2017 12:46
Show Gist options
  • Select an option

  • Save pvin/63e548d86d1a6782f059af7dbf2620e5 to your computer and use it in GitHub Desktop.

Select an option

Save pvin/63e548d86d1a6782f059af7dbf2620e5 to your computer and use it in GitHub Desktop.
begin
ActiveRecord::Base.transaction do
User.create(name: 'test')
Role.create(name:'manager')
end
rescue => e
raise ActiveRecord::Rollback
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment