I have modified scaffolding code slightly to get three edit actions and three update actions.
The requirement: to allow users to edit attributes for the same model from seperate forms instead of one form, while using the given scaffolding code and performing model validations. I am using restful_authentication with the login email password validations defined.
class users_controller
edit_email edit_login edit_password
update_email if update_attr save else render => edit_email update_login if update_attr save else render => edit_login update_password @curr_pass = params[:curr+passs] if update_attr save else render => edit_password
end
i have made routes
edit_email_path edit_login_path edit_password_path update_email_path update_login_path update_password_path
I can get the update_email and update_login to work if I avoid setting password validations on update. When i set the password validations on update, i can get the update_password to work, but update_email, and update_login fail validations because they are trying to validate passwords too when there is no form elements for them.
Is there a way to make password validations only run when update_attribute(params[:user]) is called within the update_password controller method and to prevent password validations to run when update_email and update_login update_attribute(params[:user]) methods are called? Thanks in advance.