My rails scope is not working on heroku due to sqlite and postgresql database difference on development and production/heroku
I have following scope working on my development
#conversations_controller
scope :between, -> (sender_id,recipient_id) do
where("(conversations.sender_id = ? AND conversations.recipient_id =?) OR (conversations.sender_id = ? AND conversations.recipient_id =?)", sender_id,recipient_id, recipient_id, sender_id)
end
scope :involving, -> (user) do
where("conversations.sender_id =? OR conversations.recipient_id =?",user.id,user.id)
end
i need its equivalent for postgresql
The error i'm getting is
An ActiveRecord::StatementInvalid occurred in conversations#create:
PG::UndefinedTable: ERROR: relation "conversations" does not exist
LINE 1: SELECT "conversations".* FROM "conversations" WHERE ((conver...
^
: SELECT "conversations".* FROM "conversations" WHERE ((conversations.sender_id = '1' AND conversations.recipient_id ='6') OR (conversations.sender_id = '6' AND conversations.recipient_id ='1'))
app/controllers/conversations_controller.rb:5:in `create'
P.S. 'heroku run rake db:migrate' was timing out so i ran 'heroku run:detached rake db:migrate' , does that make any difference ?
Thanks in advance !
Aucun commentaire:
Enregistrer un commentaire