Greg Hauptmann
2006-Oct-09 20:27 UTC
error running ''ruby script/console'' => "uninitialized constant RAILS_ROOT" ??
Hi, Anyone suggest why when I try to run the console via ''ruby script/console'' I get the following "uninitialized constant RAILS_ROOT" ?? Error: ===============================V:\Source\testapp>ruby script\console Loading development environment. ./script/../config/../config/environment.rb:3:NameError: uninitialized constant RAILS_ROOT C:/InstantRails/ruby/lib/ruby/1.8/irb/init.rb:252:in `require'': no such file to load -- console_app (LoadError) from C:/InstantRails/ruby/lib/ruby/1.8/irb/init.rb:252:in `load_modules'' from C:/InstantRails/ruby/lib/ruby/1.8/irb/init.rb:250:in `load_modules'' from C:/InstantRails/ruby/lib/ruby/1.8/irb/init.rb:21:in `setup'' from C:/InstantRails/ruby/lib/ruby/1.8/irb.rb:54:in `start'' from C:/InstantRails/ruby/bin/irb.bat:20 =============================== environment.rb ==================================require "#{RAILS_ROOT}/config/nested_layout.rb" ENV[''RAILS_ENV''] ||= ''production'' RAILS_GEM_VERSION = ''1.1.6'' require File.join(File.dirname(__FILE__), ''boot'') Rails::Initializer.run do |config| end module ActiveRbacConfig config :controller_layout, "contacts" end Engines.start :active_rbac ActiveSupport::CoreExtensions::Time::Conversions::DATE_FORMATS.update(:default => ''%H:%M:%S %d-%m-%Y'') # e.g. 10-31-2006 @ 9:30 PM LOCALES = {''en'' => ''en'', ''fr'' => ''fr''}.freeze =================================== Thanks Greg --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---
Daniel Azuma
2006-Oct-10 16:44 UTC
Re: error running ''ruby script/console'' => "uninitialized co
Greg, In your environment.rb, try moving the first line require "#{RAILS_ROOT}/config/nested_layout.rb" and put it AFTER the line that goes require File.join(File.dirname(__FILE__), ''boot'') I''m not sure what nested_layout.rb is supposed to do, but RAILS_ROOT won''t work until the boot process is complete. Alternately, if that doesn''t work, you can try replacing that first line with: require File.join(File.dirname(__FILE__), ''nested_layout.rb'') (since your environment.rb is already in the config directory.) Daniel Azuma Zoodango.com Greg Hauptmann wrote:> Hi, > > Anyone suggest why when I try to run the console via ''ruby > script/console'' I > get the following "uninitialized constant RAILS_ROOT" ?? > > > Error: > ===============================> V:\Source\testapp>ruby script\console > Loading development environment. > ./script/../config/../config/environment.rb:3:NameError: uninitialized > constant RAILS_ROOT > C:/InstantRails/ruby/lib/ruby/1.8/irb/init.rb:252:in `require'': no such > file > to load -- console_app (LoadError) > from C:/InstantRails/ruby/lib/ruby/1.8/irb/init.rb:252:in > `load_modules'' > from C:/InstantRails/ruby/lib/ruby/1.8/irb/init.rb:250:in > `load_modules'' > from C:/InstantRails/ruby/lib/ruby/1.8/irb/init.rb:21:in `setup'' > from C:/InstantRails/ruby/lib/ruby/1.8/irb.rb:54:in `start'' > from C:/InstantRails/ruby/bin/irb.bat:20 > ===============================> > environment.rb > ==================================> require "#{RAILS_ROOT}/config/nested_layout.rb" > > ENV[''RAILS_ENV''] ||= ''production'' > > RAILS_GEM_VERSION = ''1.1.6'' > > require File.join(File.dirname(__FILE__), ''boot'') > > Rails::Initializer.run do |config| > end > > module ActiveRbacConfig > config :controller_layout, "contacts" > end > Engines.start :active_rbac > ActiveSupport::CoreExtensions::Time::Conversions::DATE_FORMATS.update(:default > => ''%H:%M:%S %d-%m-%Y'') # e.g. 10-31-2006 @ 9:30 PM > LOCALES = {''en'' => ''en'', ''fr'' => ''fr''}.freeze > ===================================> > > > Thanks > Greg-- Posted via http://www.ruby-forum.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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---