开发者

how to use Heroku's application database from another Heroku application

开发者 https://www.devze.com 2023-03-11 03:07 出处:网络
I have two Rails 3 applications currently running on Heroku. One is main application and another one is Forum for the main application.

I have two Rails 3 applications currently running on Heroku. One is main application and another one is Forum for the main application.

For both of these applications I want to use a single db table for users. For this reason, in Forum application I overwritten ActiveRecord db connection settings like this.

# User model in Forum application
class User < ActiveRecord::Base
  establish_connection(
    :adapter  => "postgres",
    :host     => "ec2-XXX-XXX-XXX-XXX-XXX.compute-X.amazonaws.com",
    :username => "username",
    :password => "password",
    :database => "db_name"
  )
end

By overriding configuration, I'm getting 'activerecord-postgres-adapter' not found exception. To eliminate this exception, I added 'pg' gem in Gemfile. But still I'm facing same error.

Can anyone please let me know, how to use Heroku's application db from another Heroku application. And also which gem I need to use to avoid ab开发者_StackOverflowove Exception.

Thank You..


Use ActiveResource instead of ActiveRecord.

0

精彩评论

暂无评论...
验证码 换一张
取 消