[Rails] Proper way to save

Eric Anderson eric at afaik.us
Sun Jan 23 18:21:11 GMT 2005


What exception should I be looking for when I rescue a save. So I have 
currently

begin
	obj.save
	redirect_to :action => 'some_action'
rescue
	redirect_to :action => 'another_action'
end

This works fine but it captures all exceptions even those not related to 
validation errors. I want to only capture exceptions when there is some 
validation error. If there is some other exception thrown (bug in Rails, 
bug in my data objects, etc) then I want it thrown in that page with the 
standard Rails debugging info outputted (stack trace, etc.). But 
currently if I get some sort of error it redirects to my "failed" page 
because I am catching all exceptions.

So what is the proper exception type I should be catching?

Eric
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 187 bytes
Desc: OpenPGP digital signature
Url : http://one.textdrive.com/pipermail/rails/attachments/20050123/abc61a25/signature.bin


More information about the Rails mailing list