Concurrent users

If I have:

class ApplicationController < ActionController::Base
protect_from_forgery
before_filter RubyCAS::Filter
before_filter :fetch_operator
include SessionsHelper

private

def fetch_operator
@operator ||= session[:cas_user] &&
Operator.find_by_uid(session[:cas_user])
log_out if @operator.nil?
end

end

@operator is available for all controllers of my application.
But If I run, for example, two instances of my application from
different locations.
In the first instance the user logs in as ‘user1’, later from another
location, another user logs in as ‘user2’, then in @operator now I
have ‘user2’.
How can I do if my application is used by more than one user?

On Feb 24, 10:23am, Mauro [email protected] wrote:

def fetch_operator
location, another user logs in as ‘user2’, then in @operator now I
have ‘user2’.
How can I do if my application is used by more than one user?

That shouldn’t happen - each request has its own controller instance,
so setting @operator to one value for one request should have no
effect on its value for another request.

Fred

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs