ActiveSalesforce + Heroku + PostgreSQL + Rails 2.3.x
How to setup my Rails app so it will be able to use both Salesforce and PostgreSQL as a backend on Heroku. My current code is:
#environment.rb
...
config.gem "asf-soap-adapter", :lib => 'asf-soap-adapter'
confi开发者_如何学JAVAg.database_configuration_file = File.join(RAILS_ROOT, 'config', 'salesforce.yml')
salesforce.yml contains config for both PostgreSQL and SF. This doesn't work because it replaces current Heroku database.yml, so I am not able to connect to DB.
Any ideas how to solve this?
OK, so it seams that I have figured it out: All you need to do is to create a separate config file for backends, e.g. "salesforce.yml", which looks like this:
development:
# usual stuff that you put at your database.yml
test:
# usual stuff that you put at your database.yml
production:
# you need to get following from Heroku (http://devcenter.heroku.com/articles/database#database_urls)
host: #host of Herkou db
adapter: postgresql
encoding: unicode
database: # Heroku db name
username: # Heroku db username
password: # Heroku db password
salesforce-default-realm:
adapter: activesalesforce
url: https://www.salesforce.com
username: #salesforce username
password: #{salesforce_password}{salesforce_security_token}
api_version: 20.0
Then environment.rb:
...
config.gem "asf-soap-adapter", :lib => 'asf-soap-adapter'
config.database_configuration_file = File.join(RAILS_ROOT, 'config', 'salesforce.yml')
精彩评论