Are you saying that all constants should be defined in the
environment.rb file?



On Jun 5, 8:25 pm, Sandip Ransing <[email protected]> wrote:
> Constants can't be reinitialized,
> so, Initialize constant while server starts
> add this to the end of environment.rb
>
>  DAYS_ALLOWED_FOR_CHANGE = 2
>  DAYS_PER_WEEK = 7
>
> - Sandip R~
>
>
>
> On Fri, Jun 5, 2009 at 3:49 PM, 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?
>
> > Any advice appreciated.
>
> > Thanks
> > Adrian
>
> --
> Ruby on Rails 
> Developerhttp://sandip.sosblog.comhttp://funonrails.wordpress.comwww.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
-~----------~----~----~----~------~----~------~--~---

Reply via email to