Very interesting I will try it right away (actually I never done anything to application.rb) and the way u treat it I think it will work, thanks.
On Feb 9, 5:16 pm, Ram <[email protected]> wrote: > Geekyra, > > Interesting.. had the same issue. Put this 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 > > --courtesy Pratik Naik (though highly NOT recommended by him) > > works like a charm. > > On Feb 9, 9:26 am, Julian Leviston <[email protected]> wrote: > > > What do u mean? > > > Blog:http://random8.zenunit.com/ > > Learn rails:http://sensei.zenunit.com/ > > > On 09/02/2009, at 3:22 AM, Geekyra <[email protected]> wrote: > > > > Hello, can anybody help me, how to pass @current_user (generated by > > > session[user_id] into a model ? for example I have a relationship like > > > below : > > > > User has many Journals > > > User has many Categories > > > Journals has many Items > > > Items has many Categories > > > > The problem is I like to sum "amount" field in Item model based on > > > category and user. So every user has their own category and their own > > > category amount. So if I want to make a method that return sum of item > > > amount where do I put it anyway ? On this problem I can't make through > > > association cause User and Item doesn't related at all, they only > > > related by journals data. --~--~---------~--~----~------------~-------~--~----~ 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 [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---

