When I run cap staging deploy:check
it succeeds. When I run cap staging deploy
it succeeds until deploy:assets:precompile
at which I get this error:
01 ~/.rvm/bin/rvm default do bundle exec rake assets:precompile
01 rake aborted!
01 ActiveRecord::StatementInvalid: PG::UndefinedTable: ERROR: relation "links" does not exist
01 LINE 1: SELECT "links".* FROM "links"
After googling, I believe the problem is that it is trying to create the relations before creating the tables. I have since tried many solutions including placing config.assets.initialize_on_precompile = false
in application.rb but none of them work.
I desperately need help. Thank you!
The problem is that the asset:precompile task boots up the full Rails environment. Do you have any initializers or something that use Link model?
Dirty workaround:
ssh to the staging server, go to :deploy_path you've set in capistrano's config and then in last release folder. After that manually run RAILS_ENV=staging bundle exec rake db:migrate.