[Rails] Validates attributes that aren't even being changed
I have a form where I can only update the user's first name, last name
and email address.
I have this in the user model file, user.rb
validates :username,
:presence => true,
:uniqueness => true,
:on => :update
validates :password,
:presence => true,
:length => { :minimum => 6, :maximum => 20},
:confirmation => true,
:on => :update
But everytime I try to change the user's first name, I get the error
messages that the username is already taken and such. I'm not even
trying to update the username. And there is NOT EVEN A FIELD for the
username in the form.
When I try to update the user's first name in the console, I get the
same errors.
How can I make Rails NOT run that validation when I'm trying to update
other fields?
--
Posted via http://www.ruby-forum.com/.
--
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.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home