2011-05-30 83 views
0

如何设置我的Rails应用程序,以便能够将Salesforce和PostgreSQL作为Heroku的后端使用。我目前的代码是:ActiveSalesforce + Heroku + PostgreSQL + Rails 2.3.x

#environment.rb 
... 
config.gem "asf-soap-adapter", :lib => 'asf-soap-adapter' 
config.database_configuration_file = File.join(RAILS_ROOT, 'config', 'salesforce.yml') 

salesforce.yml包含PostgreSQL和SF的配置。这不起作用,因为它取代了当前的Heroku database.yml,所以我无法连接到数据库。

任何想法如何解决这个问题?

回答

0

好的,所以它接缝,我已经想通了: 所有你需要做的是为后端创建一个单独的配置文件,例如, “salesforce.yml”,它看起来像这样:

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 

然后environment.rb中:

... 
config.gem "asf-soap-adapter", :lib => 'asf-soap-adapter' 
config.database_configuration_file = File.join(RAILS_ROOT, 'config', 'salesforce.yml')