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
我收到了上述错误,我正在尝试将salesforce与跟踪PDF的rails应用集成在一起:http://blogs.developerforce.com/developer-relations/2011/02/a-brief-history-of-ruby-rails-with-the-forcecom-platform.html
我已经完成了所需的说明,但是需要编辑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
答案 0 :(得分:3)
我根据您的标记假设您正在使用Rails 3应用程序,您遇到的问题是您拥有的environment.rb是特定于Rails 2的。在Rails 3中,您应该在Gemfile中指定您的gem,并从您的environment.rb中删除Rails :: Initializer。
将此添加到您的Gemfile:
gem 'asf-soap-adapter', :require =>'activerecord-activesalesforce-adapter'
这里有一些关于从Rails 2升级的注释 - > Rails 3。
http://rails3.community-tracker.com/permalinks/5/notes-from-the-field-upgrading-to-rails-3
答案 1 :(得分:0)
我使用新的Gem'databasedotcom'用于同样的目的,完美无缺 http://richardvanhook.github.com/databasedotcom-guide/#create_a_databasecom_account