Hello all,
I’ve installed the acl plugin and all works fine.
Now I added a new page where the user can change it’s name and e-mail
but it does not work. When I try to save there are always validation
errors because the password and password_confirmation because they
aren’t present in the form.
Can anyone tell me how to correct this?
Here is the code:
Form:
Name:<%= text_field “user”, “name”, :size
=> 30 %>
Email:<%= text_field “user”, “email”,
:size => 30 %>
<%= submit_tag “Change”, { ‘name’ => ‘change’} %>
Controller:
@user = User.find(user_id)
@user.name = @params[“user”][“name”]
@user.email = @params[“user”][“email”]
if @user.save()
redirect
end
Model User:
validates_presence_of :password, :password_confirmation
validates_length_of :password, :within => 5…40
validates_confirmation_of :password
Thanks,
Migrate