>Mark Reginald James wrote:
>> Michael Kahle wrote:
>> getting over my head! :)
> If a model before_validation, after_validation, or before_save
> method or block returns false, a valid record won't be saved,
> but you only get an exception if the saving method ended with
> an exclamation mark.

I understand.  What I don't understand is: when is the model 
automatically checked?  Anytime you submit the form back to the 
controller?

>> Are you saying that anything caught by "rescue" is something that you 
>> wouldn't want to pass back to the user?  Is this because, let's say, in 
>> the event of a database failure it would better to send this to a log 
>> file or something similar?  Is the idea behind what you are saying that 
>> we should only be passing validation errors back to the user?
> 
> While you can use rescue sections in individual actions to
> specially handle and inform users about action-specific errors,
> to prevent duplication it's usually best to have other exceptions
> handled by a single method in application.rb that informs both the
> user and the developer than an unexpected error has occurred.
> e.g. See the exception_notification plugin.

Nice advice.  I'll check out that plugin in the next few days.  I need 
to get this iteration complete.  :)
-- 
Posted via http://www.ruby-forum.com/.

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

Reply via email to