2011-10-12 139 views
0
environment.rb:7: uninitialized constant Rails::Initializer (NameError) 
    from /usr/lib/ruby/gems/1.8/gems/railties-3.1.0/lib/rails/application.rb:78:in `require_environment!' 
    from /usr/lib/ruby/gems/1.8/gems/railties-3.1.0/lib/rails/commands.rb:39 
    from script/rails:6:in `require' 
    from script/rails:6 

,我發現了前面的錯誤,我想銷售團隊與Rails應用程序的PDF這裏下列整合未初始化的常量的Rails:http://blogs.developerforce.com/developer-relations/2011/02/a-brief-history-of-ruby-rails-with-the-forcecom-platform.html::初始化程序(NameError)

我已經作出所需的說明,但它需要編輯environment.rb 這裏是我當前版本:

# Load the rails application 
require File.expand_path('../application', __FILE__) 

# Initialize the rails application 
Newsletter::Application.initialize! 

Rails::Initializer.run do |config| 
    config.gem "asf-soap-adapter", :lib => "activerecord-activesalesforce-adapter" 
    config.gem "asf-soap-adapter", :lib => 'asf-soap-adapter' 
    config.database_configuration_file = File.join(RAILS_ROOT, 'config','salesforce.yml') 
    config.time_zone = 'UTC' 
end 

回答

3

我想根據你的標籤,你是在Rails 3應用程序的工作,你有問題是,你的environment.rb有鐵s 2具體。在Rails 3中,你應該在你的Gemfile中指定你的gem,然後從你的environment.rb中移除Rails :: Initializer。

添加到您的Gemfile:

gem 'asf-soap-adapter', :require =>'activerecord-activesalesforce-adapter' 

這裏有一些注意事項上的升級,從梁2 - > Rails的3

http://rails3.community-tracker.com/permalinks/5/notes-from-the-field-upgrading-to-rails-3

+0

謝謝!這幫助了我。 – Tabrez

相關問題