##Problem: While trying to deploy an app to heroku, a table was chronically not found, preventing asset precompile.
Migrating the db on heroku would seem successfull, but trying to push to heroku would result in this error:
remote: Running: rake assets:precompile
remote: rake aborted!
remote: ActiveRecord::StatementInvalid: PG::UndefinedTable: ERROR: relation "********" does not exist
.
.
.
remote: ! Precompiling assets failed.
remote: !
remote: ! Push rejected, failed to compile Ruby app.
remote:
remote: ! Push failed
remote: Verifying deploy...
remote:
remote: ! Push rejected to ********.
remote:
To *****heroku url*****
! [remote rejected] staging -> master (pre-receive hook declined)
error: failed to push some refs to '*****heroku url*****'
##Solution
I don't know why, but the table seemed to be actually missing, and migrating wasn't creating it. I had to drop the database and rebuild it.
heroku pg:reset DATABASE --app appname
where appname is the name of the app on heroku.
This is not ideal, as it destroys the database. This should not be used in production since data will be lost.
AHHHHH! I know what's happening now - I renamed some tables (probably the wrong way) and instead of renaming the existing tables in my local app, new ones were made. The old ones are still in schema.rb, but there are no corresponding migration files so heroku rake db:migrate can't add the tables that are referenced in the schema.rb file. I need to drop the offending tables and remove them from schema.rb.