I need to save 3 kinds of records in one transaction and throw an
exception if one error occurs in any one of the models : User ->>
Proposal ->> Rating
I wrote in my controller :
user = User.new(…)
begin User.transaction(user) do user.save proposal = Proposal.new(:user_id => @user.id, ..... ) proposal.save rating = Rating.new( :proposal => @proposal.id, .... ) rating.save end rescue render :action => 'error_action' end redirect_to :action => 'no_error-action'
I have errors in user, proposal and rating but no exception is raised …