Tuesday, December 4, 2012

Re: [Rails] [Rails 3.2] validation on create not working

On 4 December 2012 10:03, Erwin <yves_dufour@mac.com> wrote:
>
> class Place < ActiveRecord::Base
>
> validates :description, :presence => true
> validates :description, :uniqueness => {:case_sensitive => true, :on =>
> :create }
> # also tried
> # validates :description, :uniqueness => {:case_sensitive => true }, :on
> => :create
>
> On update ( in form fields, updated label, same description )
> params
> {"event"=>{"place_attributes"=>{"label"=>"a very beautiful place",
> "description"=>"where you should go..."}}
>
> @event.errors debugging
> @messages={:"place.description"=>["has already been taken"]}> !!
> uniqueness should not be checked ¿

I don't understand what is happening that is not as you expect.
Please try and explain in more detail.

Colin

--
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 https://groups.google.com/groups/opt_out.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate