Module accessing controller data

I have data, :current_user, in my Application Controller:

class ApplicationController < ActionController::Base
helper_method :current_user
private
def current_associate
return @current_associate if defined?(@current_associate)
@current_associate = current_associate_session &&
current_associate_session.record
end
end

, so it is inherited by the controllers that inherit
ApplicationController

I have a module, which is ‘required’ by several controllers who
inherit from ApplicationController. One of controllers is descended
from Application Controller – another is not (it is descended from
RuportController). The latter needs to access :current_user.

What is the best way to accomplish this? (I have tried
setting :current_user in the module, so that the controller that is
derived from RuportController might be able to call the module to
obtain it, with no luck).

Ultimately, I need to get :current_user into the controller derived
from RuportController – but how?

Thanks, R.Vince

Hi R. Vince,

What does RuportController inherit from?

/Lasse

2010/4/15 RVince [email protected]

Lasse,

It doesn;t inherit anything:

class Ruport::Controller

-R.Vince

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