David Kahn
2010-Nov-12 15:12 UTC
Re: Can I not reference from production.rb a constant in environment.rb? [SOLVED]
Please disregard, solved. The answer was to move my constants higher in environment.rb (before require File.expand_path(''../application'', __FILE__)). Apparently with this line in environment.rb, Rails loads all models when it hits this line, thus if there are constants referenced in the models which appear below in environment.rb, an error is thrown. Solution is to move constants before this line. require File.expand_path(''../application'', __FILE__) On Fri, Nov 12, 2010 at 9:07 AM, David Kahn <dk-rfEMNHKVqOwNic7Bib+Ti1W1rNmOCjRP@public.gmane.org>wrote:> I have the following constant in production.rb: > GSA_EPLS_DATASOURCE = FILESTORE + "/" + "datafiles/gsa_epls.xml" > > The constant FILESTORE is located in environment.rb: > FILESTORE = "../creditcompare_filestore/" + Rails.env > > When I try to migrate my db on heroku I get this error which points to the > line above in production.rb > > uninitialized constant FILESTORE > > > So I am gathering that there is a load sequence issue. I am trying to keep > FiLESTORE in highest level as it applies to all environments... I dont have > to but would like to. Is there a way to do what I am trying to do? >-- 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.