Class: Authlogic::AuthenticatesMany::Association
- Inherits:
-
Object
- Object
- Authlogic::AuthenticatesMany::Association
- 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
-
#find_options ⇒ Object
Returns the value of attribute find_options.
-
#id ⇒ Object
Returns the value of attribute id.
-
#klass ⇒ Object
Returns the value of attribute klass.
Instance Method Summary collapse
-
#initialize(klass, find_options, id) ⇒ Association
constructor
-
id: Usually ‘nil`, but if the `scope_cookies` option is used, then `id` is a string like “company_123”.
-
Constructor Details
#initialize(klass, find_options, id) ⇒ Association
-
id: Usually ‘nil`, but if the `scope_cookies` option is used, then `id` is a string like “company_123”. It may seem strange to refer to such a string as an “id”, but the naming is intentional, and is derived from `Authlogic::Session::Id`.
26 27 28 29 30 |
# File 'lib/authlogic/authenticates_many/association.rb', line 26 def initialize(klass, , id) self.klass = klass self. = self.id = id end |
Instance Attribute Details
#find_options ⇒ Object
Returns the value of attribute find_options.
20 21 22 |
# File 'lib/authlogic/authenticates_many/association.rb', line 20 def @find_options end |
#id ⇒ Object
Returns the value of attribute id.
20 21 22 |
# File 'lib/authlogic/authenticates_many/association.rb', line 20 def id @id end |
#klass ⇒ Object
Returns the value of attribute klass.
20 21 22 |
# File 'lib/authlogic/authenticates_many/association.rb', line 20 def klass @klass end |