I have my User model authenticating with Devise and I want to overwrite the valid_password method as this, in my user.rb inside the class definition I have
class User < ActiveRecord::Base
devise :database_authenticatable
# overwriting the valid_password from database_authenticatable
module PostDatabaseAuthenticatable
def valid_password?(password)
if old_password
# do something new
else
# call valid_password from DatabaseAuthenticatable
super
end
end
end
include PostDatabaseAuthenticatable
end
So First we include the database_authenticatable through devise then include my PostDatabaseAuthenticatable so according to what I read Rails 3: alias_method_chain still used? it should totally overwrite devise's valid_password method.
But when I run my code it always calls this first and then no mather what calls devise, so doesn't overwrite it at all.
Any ideas why?