I've got authlogic setup as such
acts_as_authentic do |config|
config.login_field = 'email'
config.merge_validates_length_of_email_field_options :in => 5..50
config.validates_length_of_password_field_options = {:on => :update, :minimum => 4 }
config.validates_length_of_password_confirmation_field_options = {:on => :update, :minimum => 4}
end
I can't update user attributes because the password and password_confirmation try to get validated on save and they are nil. Is there any way to turn validations off temporarily, or a better solution?
Here's how it works for me:
Add a condition to your validate statements like this:
Then add a custom
should_validate?
function to your user model. For example you could doThis way you can explicitly set
user.updating_password = true
in your controller anytime you want the password to be validated and leave it as it is if you don't want any validation.(This is my first answer, so I hope it's helpful for you. Otherwise don't hesitate to correct me.)