未初始化的常量 Rails::Initializer (NameError)
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
我遇到了前面的错误,我正在尝试按照此处的 PDF 将 salesforce 与 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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
根据您的标签,我假设您正在 Rails 3 应用程序中工作,您遇到的问题是您拥有的environment.rb 是 Rails 2 特定的。在 Rails 3 中,您应该在 Gemfile 中指定 gem,并从environment.rb 中删除 Rails::Initializer。
将其添加到您的 Gemfile 中:
这里有一些关于从 Rails 2 升级的注释 -> Rails 3。
http:// rails3.community-tracker.com/permalinks/5/notes-from-the-field-upgrading-to-rails-3
I assume based on your tag that you are working in a Rails 3 app, the issue you have is that the environment.rb you have is Rails 2 specific. In Rails 3 you should be specifying your gems in your Gemfile, and removing the Rails::Initializer from your environment.rb.
Add this to your Gemfile:
There are some notes here on the upgrade from Rails 2 -> Rails 3.
http://rails3.community-tracker.com/permalinks/5/notes-from-the-field-upgrading-to-rails-3
我使用新的 Gem 'databasedotcom' 来达到同样的目的,效果非常好
http://richardvanhook.github.com/databasedotcom-guide/#create_a_databasecom_account
I used the new Gem 'databasedotcom' for the same purpose which works perfectly
http://richardvanhook.github.com/databasedotcom-guide/#create_a_databasecom_account