Search code examples
ruby-on-railsactiveadminasset-pipelinepg

Rails 3 db:reset and assets


I made what I now see as a mistake (better now than later, not as good as never) of running rake db:reset on my local dev env to try to solve a problem I was having with assets production compilation(RAILS_ENV=production bundle exec rake assets:precompile) referring to a PG ERROR summarized bellow.

PGError: ERROR:  relation "schools" does not exist
LINE 4:              WHERE a.attrelid = '"schools"'::regclass

The tables get created properly and seeding works with exception of active_admin. I use Active_Admin that did not seed properly. My emails mysteriously stopped being sent and the assets compilation for production still fails with the same error. I am not sure what I can post here to help you understand the issue but if someone could help me tackle one at a time that would be much appreciated. Here are my issues in list form.

  1. active_admin not seeding (I tried running: rails generate active_admin:install but that started to break things further so I reverted this.
  2. PG ERROR on assets precompile for production persists.
  3. Email stopped being processed (not using DJ)

Env. Rails 3.1

------UPDATE 00------

2 is Solved. db:reset dropped all my tables but only migrated and seeded my development database so I also had to:

  • run migrate and seed for production ( rake db:migrate RAILS_ENV="production", rake db:seed RAILS_ENV="production")
  • before compiling production assets(rake db:migrate RAILS_ENV="production")

Solution

  • I ended up splitting this question into 2 parts. The second part got better contribution and is where I found the solution for this as well.

    Detailed solution here