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
I'm getting the preceding error, I'm trying to integrate salesforce with a rails app following the PDF here: http://blogs.developerforce.com/developer-relations/2开发者_开发知识库011/02/a-brief-history-of-ruby-rails-with-the-forcecom-platform.html
I have made the instructions required, however it is required to edit the environment.rb
Here is my current version:
# 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
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:
gem 'asf-soap-adapter', :require =>'activerecord-activesalesforce-adapter'
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
I used the new Gem 'databasedotcom' for the same purpose which works perfectly http://richardvanhook.github.com/databasedotcom-guide/#create_a_databasecom_account
精彩评论