Module: Devise::Orm::CouchPotato::Schema

Includes:
Schema
Defined in:
lib/devise/orm/couch_potato/schema.rb

Instance Method Summary collapse

Instance Method Details

#apply_devise_schema(name, type, options = {}) ⇒ Object

Tell how to apply schema methods.



7
8
9
10
11
12
13
14
# File 'lib/devise/orm/couch_potato/schema.rb', line 7

def apply_devise_schema(name, type, options={})
  return unless Devise.apply_schema
  if [Date, DateTime].include?(type)
    property name, options.merge({ :type => Time })
  else
    property name, options
  end
end

#find(*args) ⇒ Object



20
21
22
23
24
# File 'lib/devise/orm/couch_potato/schema.rb', line 20

def find(*args)
  options = args.extract_options!
  raise "You can't search with more than one condition yet =(" if options[:conditions].keys.size > 1
  find_by_key_and_value(options[:conditions].keys.first, options[:conditions].values.first)
end

#find_for_authentication(conditions) ⇒ Object



16
17
18
# File 'lib/devise/orm/couch_potato/schema.rb', line 16

def find_for_authentication(conditions)
  find(:conditions => conditions)
end