Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

This project is archived and is in readonly mode.

StringInquirer not required in railties

#2110

"Rails.env.(production|test|development)?" fails in config/environment.rb in Edge due to the fact that 'activesupport/string_inquirer' is no longer require'd in the file.

Reported by Stephen Touset · March 1st, 2009 @ 08:39 PM

State: invalid
Milestone: 3.x
Assigned to: nobody
Importance: none

Activity

  1. Stephen Touset
    Stephen Touset

    It seems this regression happened in this commit.

    March 1st, 2009 @ 09:19 PM

  2. Stephen Touset
  3. Jacob Atzen
    Jacob Atzen

    I can not reproduce this with the latest edge (7706b5703). With the following environment.rb:

    
    RAILS_GEM_VERSION = '2.3.1' unless defined? RAILS_GEM_VERSION
    require File.join(File.dirname(__FILE__), 'boot')
    Rails::Initializer.run do |config|
      config.time_zone = 'UTC'
    end
    p Rails.env.development?
    p Rails.env.production?
    

    I get:

    
    ./script/runner "puts 'Done'"
    true
    false
    Done
    

    March 15th, 2009 @ 02:03 PM

  4. Stephen Touset
    Stephen Touset

    The problem occurs in code in the Rails::Initializer block.

    
    RAILS_GEM_VERSION = '2.3.1' unless defined? RAILS_GEM_VERSION
    require File.join(File.dirname(__FILE__), 'boot')
    Rails::Initializer.run do |config|
      config.time_zone = 'UTC'
      p Rails.env.production?
    end
    
    
    script/runner "puts 'Done'"
    ./script/../config/../vendor/rails/railties/lib/initializer.rb:56:in `env': uninitialized constant Module::ActiveSupport (NameError)
    	from /Users/stouset/Documents/Code/afternoonoff.com/config/environment.rb:5
    	from ./script/../config/../vendor/rails/railties/lib/initializer.rb:111:in `run'
    	from /Users/stouset/Documents/Code/afternoonoff.com/config/environment.rb:3
    	from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
    	from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `require'
    	from /Users/stouset/Documents/Code/afternoonoff.com/vendor/rails/railties/lib/commands/runner.rb:39
    	from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
    	from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `require'
    	from ./script/runner:3
    

    March 15th, 2009 @ 08:36 PM

  5. Ryan Bigg
    Ryan Bigg
    • State changed from new to resolved

    Cannot reproduce on 2.3.5.

    April 29th, 2010 @ 10:28 PM

  6. Ryan Bigg
    Ryan Bigg
    • State changed from resolved to open

    Actually can. It doesn't break inside script/server but does inside script/console.

    April 29th, 2010 @ 10:35 PM

  7. José Valim
  8. Jeremy Kemper
    Jeremy Kemper
    • Milestone changed from 2.x to 3.x

    May 4th, 2010 @ 06:48 PM

  9. Gavin Stark
    Gavin Stark

    -1

    Rails 3.0.0beta3 -- having Rails.env.development? in application.rb anytime after the require 'rails/all' works. Is this even applicable to 3.x ?

    May 15th, 2010 @ 08:34 PM

  10. Enrico Bianco
    Enrico Bianco

    not reproducible in current master

    I tested this using the following environment.rb in a test rails app:

    require File.expand_path('../boot', __FILE__)
    
    require 'rails/all'
    
    # If you have a Gemfile, require the gems listed there, including any gems
    # you've limited to :test, :development, or :production.
    Bundler.require(:default, Rails.env) if defined?(Bundler)
    
    module TestMaster
      class Application < Rails::Application
        p Rails.env.development?
        p Rails.env.production?
    
        # Configure the default encoding used in templates for Ruby 1.9.
        config.encoding = "utf-8"
    
        # Configure sensitive parameters which will be filtered from the log file.
        config.filter_parameters += [:password]
      end
    end
    

    This should be the Rails 3 equivalent of placing those two lines inside of the initializer block of config/environment.rb in Rails 2.3.x.

    Using both rails c and rails s, I see no errors.

    May 15th, 2010 @ 10:43 PM

  11. José Valim
    José Valim
    • State changed from open to invalid

    May 15th, 2010 @ 10:45 PM

  12. José Valim