How to tell if an SQL transaction in rails is successful?
I was wondering how you tell if an sql transaction was successful in rails, does开发者_JAVA百科 it return true or something like that. Or does the code just error on fail?
Activerecord will throw ActiveRecord::Rollback
exception when a transaction will fail. See http://api.rubyonrails.org/classes/ActiveRecord/Transactions/ClassMethods.html and http://api.rubyonrails.org/classes/ActiveRecord/Rollback.html for more information.
精彩评论