Module: MerbAuth::Adapter::ActiveRecord::Map::ClassMethods

Defined in:
lib/merb-auth/adapters/activerecord/map.rb

Instance Method Summary collapse

Instance Method Details

#clear_database_tableObject

A method to assist with specs



36
37
38
# File 'lib/merb-auth/adapters/activerecord/map.rb', line 36

def clear_database_table
  MA[:user].delete_all
end

#find_active_with_conditions(conditions) ⇒ Object



15
16
17
18
19
20
21
22
23
# File 'lib/merb-auth/adapters/activerecord/map.rb', line 15

def find_active_with_conditions(conditions)
  if MA[:user].instance_methods.include?("activated_at")
    MA[:user].with_scope(:find => {:conditions => "activated_at IS NOT NULL"}) do
      MA[:user].find(:first, :conditions => conditions)
    end
  else
    MA[:user].find(:first, :conditions => conditions)
  end
end

#find_all_with_login_like(login) ⇒ Object



29
30
31
32
33
# File 'lib/merb-auth/adapters/activerecord/map.rb', line 29

def ()
  MA[:user].with_scope(:find => {:order => "login DESC", :limit => 1}) do
    MA[:user].find(:all, :conditions => ["login LIKE ?", ])
  end
end

#find_with_conditions(conditions) ⇒ Object



25
26
27
# File 'lib/merb-auth/adapters/activerecord/map.rb', line 25

def find_with_conditions(conditions)
  MA[:user].find(:first, :conditions => conditions)
end