Thats pretty much what I have.  Problem is, I still need code in the
controller I am submitting to that looks like this:

if !item.save
  # Handle save validation failure
end

Are you saying that I should not need code like that in my submit
controller?  If so, is there anything special that needs to occur for this
to work?

Thanks,

On Thu, Jul 2, 2009 at 12:36 AM, Älphä Blüë <
rails-mailing-l...@andreas-s.net> wrote:

>
> http://guides.rubyonrails.org/activerecord_validations_callbacks.html
>
> Start with this to get yourself familiar with how validation_callbacks
> work.  Generally, if you are using a form in a view (form_for as an
> example) you have a form that is backed by the model.  Therefore, you
> are placing the validation checks in the model, not the controller.
>
> Viewer
> -- has form_for...
> Controller
> --
> Model
> -- validates_presence_of  :name
> -- validates_..._ .. etc
>
> Depending on the type of validation you provide in the model, rails will
> automatically catch the error if it occurs.
>
> Keep in mind that if you are using form_tag you cannot perform model
> validation callbacks because that form is not backed by a model.  You'd
> have to use javascript, or something else to do validation checks.
>
>
>
>
> --
> 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 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to