Class: Authlogic::AuthenticatesMany::Association

Inherits:
Object
  • Object
show all
Defined in:
lib/authlogic/authenticates_many/association.rb

Overview

An object of this class is used as a proxy for the authenticates_many relationship. It basically allows you to “save” scope details and call them on an object, which allows you to do the following:

@account.user_sessions.new
@account.user_sessions.find
# ... etc

You can call all of the class level methods off of an object with a saved scope, so that calling the above methods scopes the user sessions down to that specific account. To implement this via ActiveRecord do something like:

class User < ActiveRecord::Base
  authenticates_many :user_sessions
end

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(klass, find_options, id) ⇒ Association

Returns a new instance of Association.



19
20
21
22
23
# File 'lib/authlogic/authenticates_many/association.rb', line 19

def initialize(klass, find_options, id)
  self.klass = klass
  self.find_options = find_options
  self.id = id
end

Instance Attribute Details

#find_optionsObject

Returns the value of attribute find_options.



17
18
19
# File 'lib/authlogic/authenticates_many/association.rb', line 17

def find_options
  @find_options
end

#idObject

Returns the value of attribute id.



17
18
19
# File 'lib/authlogic/authenticates_many/association.rb', line 17

def id
  @id
end

#klassObject

Returns the value of attribute klass.



17
18
19
# File 'lib/authlogic/authenticates_many/association.rb', line 17

def klass
  @klass
end