Skip to content

Instantly share code, notes, and snippets.

@S2
Created December 17, 2018 02:47
Show Gist options
  • Save S2/667eee1865da2301b4df89041dc17aef to your computer and use it in GitHub Desktop.
Save S2/667eee1865da2301b4df89041dc17aef to your computer and use it in GitHub Desktop.
[5] pry(main)> ActiveRecord::Base.transaction do
[5] pry(main)* Staff.create!(email:"s2otsa59@gmail.com",password:"hoge",first_name:"hoge",last_name:"hoge",first_name_kana:"hoge",last_name_kana:"hoge",tel:"hoge")
[5] pry(main)* raise
[5] pry(main)* end
(0.3ms) BEGIN
Staff Create (0.5ms) INSERT INTO `staffs` (`email`, `password_digest`, `last_name`, `first_name`, `last_name_kana`, `first_name_kana`, `tel`) VALUES ('s2otsa59@gmail.com', '$2a$10$3A0bATSBfepHxZhsa52bBuc9Ps6dcq60sWyiPqEiqLuDc0EKwSWGa', 'hoge', 'hoge', 'hoge', 'hoge', 'hoge')
(1.9ms) ROLLBACK
RuntimeError:
from (pry):15:in `block in __pry__'
[6] pry(main)> ActiveRecord::Base.transaction do
[6] pry(main)* Staff.create!(email:"s2otsa59@gmail.com",password:"hoge",first_name:"hoge",last_name:"hoge",first_name_kana:"hoge",last_name_kana:"hoge",tel:"hoge")
[6] pry(main)* raise
[6] pry(main)* rescue Exception => e
[6] pry(main)* p e
[6] pry(main)* end
(0.4ms) BEGIN
Staff Create (0.5ms) INSERT INTO `staffs` (`email`, `password_digest`, `last_name`, `first_name`, `last_name_kana`, `first_name_kana`, `tel`) VALUES ('s2otsa59@gmail.com', '$2a$10$H5ej67m2F6HAHSaDkxLbl.rrv1QcEjYFS4AWOIR0s/Z6LoNwHFd6K', 'hoge', 'hoge', 'hoge', 'hoge', 'hoge')
RuntimeError
(2.4ms) COMMIT
=> RuntimeError
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment