module Authlogic::Session::Existence::InstanceMethods
Public Instance Methods
destroy()
click to toggle source
Clears all errors and the associated record, you should call this terminate a session, thus requiring the user to authenticate again if it is needed.
# File lib/authlogic/session/existence.rb, line 52 def destroy before_destroy save_record errors.clear @record = nil after_destroy true end
new_session?()
click to toggle source
Returns true if the session is new, meaning no action has been taken on it and a successful save has not taken place.
# File lib/authlogic/session/existence.rb, line 63 def new_session? new_session != false end
save() { |result| ... }
click to toggle source
After you have specified all of the details for your session you can try to save it. This will run validation checks and find the associated record, if all validation passes. If validation does not pass, the save will fail and the errors will be stored in the errors object.
# File lib/authlogic/session/existence.rb, line 72 def save result = nil if valid? self.record = attempted_record before_save new_session? ? before_create : before_update new_session? ? after_create : after_update after_save save_record self.new_session = false result = true else result = false end yield result if block_given? result end
save!()
click to toggle source
Same as save but raises an exception of validation errors when validation fails
# File lib/authlogic/session/existence.rb, line 95 def save! result = save raise SessionInvalidError.new(self) unless result result end