Class/Module Index [+]

Quicksearch

Authlogic::Session::MagicColumns::InstanceMethods

The methods available for an Authlogic::Session::Base object that make up the magic columns feature.

Private Instance Methods

set_last_request_at?() click to toggle source

This method lets authlogic know whether it should allow the last_request_at field to be updated with the current time (Time.now). One thing to note here is that it also checks for the existence of a last_request_update_allowed? method in your controller. This allows you to control this method pragmatically in your controller.

For example, what if you had a javascript function that polled the server updating how much time is left in their session before it times out. Obviously you would want to ignore this request, because then the user would never time out. So you can do something like this in your controller:

def last_request_update_allowed?
  action_name =! "update_session_time_left"
end

You can do whatever you want with that method.

# File lib/authlogic/session/magic_columns.rb, line 79
def set_last_request_at? # :doc:
  return false if !record || !klass.column_names.include?("last_request_at")
  return controller.last_request_update_allowed? if controller.responds_to_last_request_update_allowed?
  record.last_request_at.blank? || last_request_at_threshold.to_i.seconds.ago >= record.last_request_at
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.