ActiveSalesforce + Heroku + PostgreSQL +导轨 2.3.x

发布于 2024-11-10 15:38:14 字数 395 浏览 0 评论 0原文

如何设置我的 Rails 应用程序,以便它能够使用 Salesforce 和 PostgreSQL 作为 Heroku 上的后端。我当前的代码是:

#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,所以我无法连接到数据库。

有什么想法如何解决这个问题吗?

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'
config.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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

醉酒的小男人 2024-11-17 15:38:14

好吧,看来我已经弄清楚了:
您需要做的就是为后端创建一个单独的配置文件,例如“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')

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')
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文