Module: Authentasaurus::Models::Session::ClassMethods
- Defined in:
- lib/authentasaurus/models/session.rb
Instance Method Summary collapse
-
#create(*attrs) ⇒ Object
Takes a hash of attributes keys and values just like new and authenticates the information.
-
#current_user(id, session_type = :user) ⇒ Object
Takes an id (usually from an ActiveController session) and returns a User object.
Instance Method Details
#create(*attrs) ⇒ Object
Takes a hash of attributes keys and values just like new and authenticates the information. Returns true or false
17 18 19 20 21 22 23 |
# File 'lib/authentasaurus/models/session.rb', line 17 def create(*attrs) attributes = attrs. attrs = attrs.flatten self_obj = self.new attributes self_obj.save(attrs) return self_obj end |
#current_user(id, session_type = :user) ⇒ Object
Takes an id (usually from an ActiveController session) and returns a User object
26 27 28 |
# File 'lib/authentasaurus/models/session.rb', line 26 def current_user(id, session_type = :user) session_type.to_s.camelize.constantize.find id end |