Sadeesh Viswanthan wrote: > Yes you could access the session variable in model. Paste the below > code in application.rb > -------------- > around_filter :you_dont_have_bloody_clue > > protected > > def you_dont_have_bloody_clue > klasses = [ActiveRecord::Base, ActiveRecord::Base.class] > methods = ["session", "cookies", "params", "request"] > > methods.each do |shenanigan| > oops = instance_variable_get(:"@_#{shenanigan}") > > klasses.each do |klass| > klass.send(:define_method, shenanigan, proc { oops }) > end > end > > yield > > methods.each do |shenanigan| > klasses.each do |klass| > klass.send :remove_method, shenanigan > end > end > > end > -------------- > > Now continue using the session variable in model. It works for me. > Thanks, > Sadeesh.
If I had a programmer working on my team and I ran across code like this, well he wouldn't be working on my team long. Just saying. I am firmly rooted in the camp where model code is decoupled from external data such as session, request or whatever else is the responsibility of the View or Controller layers. -- Posted via http://www.ruby-forum.com/. -- 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-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.