On Jan 31, 2010, at 1:04 PM, Ralph S. wrote:
Does anyone know of an RoR example of how to do that?
I think the jQuery validate function I want is “remote”.
Is there any way for that function to call a RoR action in a model or
It’s easy. I don’t have any code close at hand, but it’s pretty
straightforward – stick the validation URL in an attribute you can
access then use that. Just remember to have your authenticity
certificate as part of the post data so Rails doesn’t suspect a forgery.
Marnen’s right, you shouldn’t rely completely on client-side validation,
but I typically do as much validation as possible on the client to avoid
beating up the server and/or spoiling the client experience, then
validate everything completely on the server to prevent attacks or
mis-entries on the part of people who have disabled js.