简体   繁体   中英

how to use Heroku's application database from another Heroku 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 above Exception.

Thank You..

Use ActiveResource instead of ActiveRecord.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM