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 -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Hi R. Vince, What does RuportController inherit from? /Lasse 2010/4/15 RVince <rvince99-PkbjNfxxIARBDgjK7y7TUQ@public.gmane.org>> 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 > > -- > You received this message because you are subscribed to the Google Groups > "Ruby on Rails: Talk" group. > To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org<rubyonrails-talk%2Bunsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> > . > For more options, visit this group at > http://groups.google.com/group/rubyonrails-talk?hl=en. > >-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Lasse, It doesn;t inherit anything: class Ruport::Controller ... -R.Vince On Apr 15, 3:20 pm, Lasse Bunk <lasseb...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hi R. Vince, > > What does RuportController inherit from? > > /Lasse > > 2010/4/15 RVince <rvinc...-PkbjNfxxIARBDgjK7y7TUQ@public.gmane.org> > > > 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 > > > -- > > You received this message because you are subscribed to the Google Groups > > "Ruby on Rails: Talk" group. > > To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > > To unsubscribe from this group, send email to > > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org<rubyonrails-talk%2Bunsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> > > . > > For more options, visit this group at > >http://groups.google.com/group/rubyonrails-talk?hl=en.-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.