These are my models:
class Product has_many :line_items has_many :orders, :through => :line_items end class LineItem belongs_to :order belongs_t
I had this error, but dropping my local database with rake db:drop and then creating with rake db:create before running pg_restore with the heroku db dump solved it.
rake db:drop
rake db:create
pg_restore