On Tuesday 03 November 2009 09:10:20 Josef Reidinger wrote:
Martin Kudlvasr write:
Maybe I misunderstood the code, but using Singleton module will not preserve the instance between requests. Just try to create a simple Singleton counter and view it a few times in some controller. Singletons are regular instances of regular ruby class. The only difference is, that you can make (new) only one of them. But they are lost at the end of request like any other instance. For storing values between requests AFAIK only database and module namespace hacks work. I don't have anything against storing values in module namespace, but I suggest doing it readable. For instance by writing some "ModuleStorage" class/module whose only purpose would be to store and retrieve values using module namespace.
Hi, Can you reproduce it? I am not able to do it. Also if singleton doesn't preserve between request then something is very bad with ruby garbage collector (if rails doesn't restart itself after each request), because there exist reference to instance of class and it should not be destroyed. What you maybe find is problem with class reloading in development mode
Aah, the development mode. That's where the problem lies. Thanks Martin -- To unsubscribe, e-mail: yast-devel+unsubscribe@opensuse.org For additional commands, e-mail: yast-devel+help@opensuse.org