Module: MongoMapper::Plugins::OpenIdAuthentication::ClassMethods

Defined in:
lib/rad/mongo_mapper/acts_as/authenticated_by_open_id.rb

Instance Method Summary collapse

Instance Method Details

#acts_as_authenticated_by_open_idObject



12
13
14
15
16
17
18
19
20
# File 'lib/rad/mongo_mapper/acts_as/authenticated_by_open_id.rb', line 12

def acts_as_authenticated_by_open_id
  key :open_ids, Array
  
  # defer do
  ensure_index :open_ids
  # end

  validates_uniqueness_of :open_ids, :allow_blank => true
end

#authenticate_by_open_id(open_id) ⇒ Object



22
23
24
25
# File 'lib/rad/mongo_mapper/acts_as/authenticated_by_open_id.rb', line 22

def authenticate_by_open_id open_id
  return nil if open_id.blank?
  User.first :conditions => {:state => 'active', :open_ids => open_id}
end