module Authlogic::Session::Scopes::InstanceMethods
Public Class Methods
new(*args)
click to toggle source
Setting the scope if it exists upon instantiation.
Calls superclass method
# File lib/authlogic/session/scopes.rb, line 99 def initialize(*args) self.scope = self.class.scope super end
Public Instance Methods
scope()
click to toggle source
The scope of the current object
# File lib/authlogic/session/scopes.rb, line 105 def scope @scope ||= {} end
Private Instance Methods
build_key(last_part)
click to toggle source
Used for things like cookie_key, session_key, etc.
Calls superclass method
# File lib/authlogic/session/scopes.rb, line 112 def build_key(last_part) [scope[:id], super].compact.join("_") end
search_for_record(*args)
click to toggle source
`args` is the name of an AR method, like `find_by_single_access_token`.
# File lib/authlogic/session/scopes.rb, line 118 def search_for_record(*args) search_scope.scoping do klass.send(*args) end end
search_scope()
click to toggle source
Returns an AR relation representing the scope of the search. The relation is either provided directly by, or defined by `find_options`.
# File lib/authlogic/session/scopes.rb, line 127 def search_scope if scope[:find_options].is_a?(ActiveRecord::Relation) scope[:find_options] else conditions = scope[:find_options] && scope[:find_options][:conditions] || {} klass.send(:where, conditions) end end