Thursday, August 11, 2011

Re: [Rails] Validates attributes that aren't even being changed

On Thu, Aug 11, 2011 at 2:58 PM, Leonel *.* <lists@ruby-forum.com> wrote:

> I have this in the user model file, user.rb
>
> validates :username,
> :presence => true,
> :uniqueness => 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.

> How can I make Rails NOT run that validation when I'm trying to update
> other fields?

Seriously?

How about removing the " :on => :update " where you're telling Rails
you *do* want to run it then?

Just a thought... :-)

--
Hassan Schroeder ------------------------ hassan.schroeder@gmail.com
http://about.me/hassanschroeder
twitter: @hassan

--
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


Real Estate