I temporarily solved the username attribute by not letting the user 
update the username. So the validation only works :on => :create
So username attribute validation problem solved.

Now I got the password validation problem. Ok, it seems the problem was 
kinda of obvious but I couldn't see it.

In user.rb I have this...
-----------------------------------------
validates :password,
:presence => true,
:length => { :minimum => 6, :maximum => 20, :message => 'should have 
between 6 to 12 characters' },
:confirmation => true
------------------------------------------

but the password attribute doesn't even exist because it's a virtual 
attribute. The real attributes are password_hash and password_salt.

So the Change Password and Password Reset controllers and forms work 
well.

When I go to the Edit User page, user can edit...
* first name
* last name
* email
* there is NO Password field

PROBLEM: So when the user tries to update his, let's say, first name and 
clicks on Save Changes, I get a password length and password can't be 
blank validation error.

I'm searching for something like "rails validation exception" to solve 
this problem. If you have any suggestions please let me know.

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

Reply via email to