On 2007-02-20, at 22:42 , chrisfarms wrote:

> Thanx for the response... I'm not sure if a failed validation would
> cause a rollback.... since they don't raise an error. Unless you
> called #save!, but if this were the case then failed calls to #save
> would get past the rollback.

Indeed, I meant save!.


> I'm throwing errors around during some of my own validations, and I'm
> managing to break the transaction system (it's getting confused
> because it thinks it should rollback - when it shouldn't)

If you raise within a transaction and don't catch it, it rollsback.  
That's how it works.

Is anything different or specially weird happening in your case?


> after I looked around a bit I thought that what solves my problem
> [doing validation before starting a transaction], is actually slightly
> cleaner anyway...... unless there is some reason I'm blind to for
> having validation within the transaction?

You can always call valid? yourself before saving. I guess that's  
what you're doing now?

A good reason to have a validation happen within the transaction is  
the save! case mentioned above.


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Core" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-core?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to