On Mar 22, 4:59 pm, Piotr <[email protected]> Mąsior
<[email protected]> 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 [email protected].
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.