- SteveC (firstname.lastname@example.org) [060212 18:33]:
Chatting on the IRC channel today to people (thanks!) it came up that
submitting a form remote bypasses the :validates… in the model. At
least thats how it looks from my tests and what people said is the
Is this the case?
I don’t believe this to be the case. The form_remote routine is
invoking a controller method which by default isn’t going to know or
care how it’s called.
When the controller manipulates models it calls the Ruby methods defined
in the model classes. From the model’s point of view a call from a
controller called by form_remote looks identical to a call from a
controller not called by form_remote, which looks identical to a call
not coming from a controller at all (e.g., by Ruby code not using
anything other than the AR part of Rails, or even code called from
script/console). If model methods are called which trigger validation
in normal circumstances, they should trigger validation in the
circumstances you describe.
It seems to me it would be cumbersome to implement the “don’t call
validators when using form_remote” semantics even if that’s what one
wanted, and I can’t imagine that’s what the Rails developers have
That being all theoretical, in practice we’re using AJAX heavily,
including lots of form_remote calls, and relying on the validators
in the models quite heavily. They do indeed get called, at least in our
Perhaps you mean something else?
http://www.rickbradley.com MUPRN: 307
| website as in
random email haiku | a regular (but high
| quality) e-shop.