If you have bunch of constants then add all contsants in one file say constants.rb and put contants.rb file in config/initializers
what you say ?? - Sandip R~ On Fri, Jun 5, 2009 at 4:00 PM, Frederick Cheung <[email protected] > wrote: > > > > On Jun 5, 11:19 am, Adrian <[email protected]> wrote: > > Hi > > > > I've used a number of constants within my models to avoid magic > > numbers: > > > > class Order < ActiveRecord::Base > > > > #snip > > > > DAYS_ALLOWED_FOR_CHANGE = 2 > > DAYS_PER_WEEK = 7 > > > > #snip > > > > end > > > > However when running tests or starting the mongrel webserver I get > > warning messages such as: > > > > .../order.rb:36: warning: already initialized constant > > DAYS_ALLOWED_FOR_CHANGE > > .../order.rb:37: warning: already initialized constant DAYS_PER_WEEK > > > > How can I track down where this is being reloaded? Should I worry > > about it? > > I suspect you are using require to manually load order when you don't > need it. > > The easiest thing to do would be to stick > > puts caller > > at the top of order.rb which will spew the callstack everytime > order.rb is loaded. > > Fred > > > > Any advice appreciated. > > > > Thanks > > Adrian > > > -- Ruby on Rails Developer http://sandip.sosblog.com http://funonrails.wordpress.com www.joshsoftware.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 [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 -~----------~----~----~----~------~----~------~--~---

