rubyonrailsin

A Ruby and Rails talk

Monday, March 22, 2010


[Rails] Re: Problem with model validation with ajax

by rubyonrailsin 0 comments

Tag


Share this post:
Design Float
StumbleUpon
Reddit

So painful, I was wondering is there any dry_save or something like
this ?

On 22 Mar, 18:13, Frederick Cheung <frederick.che...@gmail.com> wrote:
> On Mar 22, 4:59 pm, Piotr <inpr...@gmail.com> MÄ…sior
>
> <inpr...@gmail.com> wrote:
> > I have got a problem with :on => create validation
>
> > validates_uniqueness_of :nip, :regon, on => :create
>
> The  :on there doesn't refer to the controller action - it refers to
> whether the save is an update to an existing record or not.
>
> Fred
>
>
>
>
>
> > Doesn't work properly when I call it via xhr
>
> > In my log
>
> > Processing AdminController#doajaxing_for_updateuser (for 127.0.0.1 at
> > 2010-03-22 17:37:13) [PUT]
> >   Parameters:
> > {"account"=>{"company_attributes"=>{"nip"=>"634-119-69-92"}},
> > "named"=>"company|nip", "locale"=>"pl"}
>
> > Processing AdminController#doajaxing_for_createuser (for 127.0.0.1 at
> > 2010-03-22 17:31:33) [POST]
> >   Parameters:
> > {"account"=>{"company_attributes"=>{"nip"=>"634-119-69-95"}},
> > "named"=>"company|nip", "locale"=>"pl"}
>
> > It looks fine, Put and Post is given by my jquery request...
>
> > But still validation is always invoking validates_uniqueness_of ....
> > why /.??
>
> > I check validation by:
>
> > @model.valid?
>
> > and later bringing messages using something like this
>
> > @model.errors[current_given]
>
> > regards

--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

No comments:

Post a Comment

Subscribe feeds via e-mail

Blog Archive