ruby on rails - undefined local variable or method `signin' for #<Class:0x31fa7f0> -
i have following error in model class. how approach such errors.
class user < activerecord::base # include default devise modules. others available are: # :confirmable, :lockable, :timeoutable , :omniauthable devise :database_authenticatable, :registerable, :recoverable, :rememberable, :trackable, :validatable attr_accessor :signin validates :username, :uniqueness => {:case_sensitive => false} def self.find_first_by_auth_conditions(warden_conditions) puts warden_conditions conditions = warden_conditions.dup where(conditions).where(["lower(username) = :value or lower(email)= :value", { :value => signin.downcase }]).first end end
i new rails , learning things doing. how debug
such issues. if such error in model, should first look.
this method devise
, auth pair username , email or else. problem in signin
variable use login
instead code:
def self.find_first_by_auth_conditions(warden_conditions) conditions = warden_conditions.dup if login = conditions.delete(:login) if login.start_with?('+') where(["phone = :value , phone_confirm = :phone_confirm", { value: login.downcase, phone_confirm: true }]).first else where(["lower(email) = :value", { value: login.downcase }]).first end else where(conditions).first end end
Comments
Post a Comment