Can anyone explain me this code in ruby? -


can explain me logic behind code?.

def self.find_first_by_auth_conditions(warden_conditions)     conditions = warden_conditions.dup     where(conditions).where(["lower(username) = :value or lower(email)     = :value", { :value => signin.downcase }]).first end 

i whole new ruby/rails community, not able understand returned function , overall function does?.

this seems part rails activerecord model.

it class method returns first record meets given conditions provided as:

  • warden_conditions
  • the downcased username or email must equal to signin.downcase

the sql equivalent should be

select * items conditions_to_sql , lower(username) = a_value or lower(email) = a_value limit 1 

Comments

Popular posts from this blog

apache - Remove .php and add trailing slash in url using htaccess not loading css -

javascript - jQuery show full size image on click -