Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class A < ActiveRecord::Base
- belongs_to :b
- end
- class B < ActiveRecord::Base
- has_many :as
- end
- b = B.create
- B.transaction do
- b.as.create!
- raise ActiveRecord::Rollback
- End
- b.save #=> ActiveRecord::StatementInvalid(“Mysql2::Error: Field ‘b_id' doesn't have a default value: INSERT INTO `as` VALUES ()”)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement