Reputation: 10224
I just deployed an application using capistrano, nginx and unicorn. I used to use Apache and Passenger but I'm trying something new.
I keep on getting error ActiveRecord::StatementInvalid (Could not find table 'users')
in my production.log (I already checked, the tables DO exist in MySQL).
I kept on looking for the reason of the error and I found out that it seems that Rails is looking for the development database (sqlite3) instead of the production database (mysql).
I followed RailsCast 335 http://railscasts.com/episodes/335-deploying-to-a-vps but I'm using MySQL instead of Postgres.
My database.yml file is located at /apps/myappname/shared/config, and this is what it contains (no info for test nor development dbs)...
production:
adapter: mysql2
database: dbname
pool: 5
timeout: 5000
host: localhost
username: db_user
password: secret
So why isn't Rails looking at this file for database access?
Upvotes: 1
Views: 437
Reputation: 10769
what about your gemfile
?
You must specify which database you are using for development and which one for production:
# make sure you place your db gems in a group block
group :development do
gem 'sqlite3'
end
group :production do
gem 'mysql'
end
Upvotes: 2