I need to implement a method which is called only once at the boot- time in my rails app. Is it possible to do this? Gábor
I think you can use the singleton mixin and do the following in an included file (from environment.rb): class RunOnce include Singleton def initialize mymethod(...) end def mymethod(...) end end RunOnce.instance On May 6, 2005, at 5:08 PM, Sebestyén Gábor wrote:> I need to implement a method which is called only once at the boot- > time in my rails app. Is it possible to do this? > Gábor > > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails >
wouldn''t placing it or a call to in environment.rb work as you have to restart the server to get changes there loaded it would only be run once. Sebestyén Gábor wrote:> I need to implement a method which is called only once at the boot- > time in my rails app. Is it possible to do this? > Gábor > > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails > >_______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails