Hello all. I need a little help to push me in the right direction. I have two main objects that I store in my session (well, I store their id). I have created a util module: #begin code module Util def get_session(klass) klass.find(session[klass.name.to_sym]) end def set_session(objek) session[objek.class.name.to_sym] = objek.id <http://objek.id> end def invalidate_session(klass) session[klass.name.to_sym] = nil end end #end code This module is declared in the application controller by adding: require_dependency ''util'' class ApplicationController < ActionController::Base include Util ... end I would like to add two more methods to the util module: def account? !session[:account_id].nil? end def site? !session[:site_id].nil? end However, this doesn''t seem to make the account? and site? methods available to the view. If I put these in the ApplicationHelper module, then they are available in the views, but not in the application controller. Am I doing something wrong? I would like these methods to be available in all controllers and views. I''m not sure if I''ll need these methods available to the models at this time. So, what am I doing wrong? Where do I place methods that are available to all controllers and all views? thanks for your help, andy -- Andrew Stone _______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails
Sorry...one code correction: def account? !session[:account].nil? end def site? !session[:site].nil? end -- Andrew Stone _______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails
I should have tried this earlier. I renamed the util module to util_system and everything is working fine. I''m not sure where the collision and am not really concerned with that at the moment. Sorry for the noise. -- Andrew Stone _______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails
> I should have tried this earlier. I renamed the util module to util_system > and everything is working fine. I''m not sure where the collision and am not > really concerned with that at the moment. >Disregard the above statement. Still having the issue, during testing I was moving the methods around and apparently they got cached because after I restarted apache the error came back. -- Andrew Stone _______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails
Found the answer... if I use @controller.site? then everything is fine. this is with the site? and account? methods in the util_system module which is included in the application controller. -- Andrew Stone _______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails