This project is archived and is in readonly mode.

#2110 ✓invalid
Stephen Touset

StringInquirer not required in railties

Reported by Stephen Touset | March 1st, 2009 @ 08:39 PM | in 3.x

"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.

Comments and changes to this ticket

  • Stephen Touset

    Stephen Touset March 1st, 2009 @ 09:19 PM

    It seems this regression happened in this commit.

  • Stephen Touset
  • Jacob Atzen

    Jacob Atzen March 15th, 2009 @ 02:03 PM

    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
    
  • Stephen Touset

    Stephen Touset March 15th, 2009 @ 08:36 PM

    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
    
  • Ryan Bigg

    Ryan Bigg April 29th, 2010 @ 10:28 PM

    • State changed from “new” to “resolved”

    Cannot reproduce on 2.3.5.

  • Ryan Bigg

    Ryan Bigg April 29th, 2010 @ 10:35 PM

    • State changed from “resolved” to “open”

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

  • José Valim

    José Valim April 30th, 2010 @ 03:16 PM

    • Tag set to bugmash
  • Jeremy Kemper

    Jeremy Kemper May 4th, 2010 @ 06:48 PM

    • Milestone changed from 2.x to 3.x
  • Gavin Stark

    Gavin Stark May 15th, 2010 @ 08:34 PM

    -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 ?

  • Enrico Bianco

    Enrico Bianco May 15th, 2010 @ 10:43 PM

    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.

  • José Valim

    José Valim May 15th, 2010 @ 10:45 PM

    • State changed from “open” to “invalid”
  • José Valim

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>

Attachments

Pages