In the logs I\'m seeing a ROLLBACK
, but no exception is logged. Is there a way to find out what caused the ROLLBACK?
Here\'s the excerpt of the log:
1) Disable before_create, before_save, before_update and check where it saves the day
2) If rollback was caused by one of those methods, check that those methods return true when you don't plan to rollback.
For example if you set default value for boolean field to avoid nil, you would probably do it this way
def set_defaults_before_create
self.my_boolean_field ||= false
end
In this example method set_defaults_before_create always returns false and thus rollbacks your transaction. So refactor it to return true
def set_defaults_before_create
self.my_boolean_field ||= false
true
end