Heroku上的共享数据库无法正常工作

时间:2011-07-15 23:57:39

标签: ruby-on-rails-3 heroku

我有app1 as:

~/Code/notifier/app1(master) $ heroku config
BUNDLE_WITHOUT      => development:test
DATABASE_URL        => postgres://abs-@ec2-50-19-213-76.compute-1.amazonaws.com/uobbhrmyhj
LANG                => en_US.UTF-8
RACK_ENV            => production
SHARED_DATABASE_URL => postgres://abs-@ec2-50-19-213-76.compute-1.amazonaws.com/uobbhrmyhj
~/Code/notifier/app1(master) $ heroku console
Ruby console for app1.heroku.com
>> User
=> User(id: integer, email: string, encrypted_password: string, reset_password_token: string, reset_password_sent_at: datetime, remember_created_at: datetime, sign_in_count: integer, current_sign_in_at: datetime, last_sign_in_at: datetime, current_sign_in_ip: string, last_sign_in_ip: string, confirmation_token: string, confirmed_at: datetime, confirmation_sent_at: datetime, created_at: datetime, updated_at: datetime)
>> 

和app2 as:

~/Code/notifier/app2(master) $ heroku config
BUNDLE_WITHOUT      => development:test
DATABASE_URL        => postgres://abs-@ec2-50-19-213-76.compute-1.amazonaws.com/uobbhrmyhj
LANG                => en_US.UTF-8
RACK_ENV            => production
SHARED_DATABASE_URL => postgres://abs-@ec2-50-19-213-76.compute-1.amazonaws.com/uobbhrmyhj
~/Code/notifier/app2(master) $ heroku console
Ruby console for app2.heroku.com
>> User
NameError: uninitialized constant User
        /home/heroku_rack/lib/console.rb:150:in `block (2 levels) in <top (required)>'
        /home/heroku_rack/lib/console.rb:140:in `eval'
        /home/heroku_rack/lib/console.rb:140:in `_eval'
        /home/heroku_rack/lib/console.rb:73:in `block in process_command'
>> 

他们都有esame数据库URL,但在第二个中无法识别“User”。遵循Heroku时事通讯,这应该有效。

由于

1 个答案:

答案 0 :(得分:1)

我不认为问题出在数据库级别,而是在app2应用程序中。