Question

I'm working on my first rails app deploy and the database data from my local computer doesn't seem to be getting loaded into the database on the server when I deploy with capistrano. I'm not clear as to whether capistrano takes care of this or not. I have also tried running 'rake db:schema:load' from the /current release directory. Here's the log of what happens when I try to load the app (on the remote webserver) in a browser.

Started GET "/" for XX.XX.XX.XX at 2012-04-04 13:26:46 -0700
  Processing by PagesController#home as HTML
Completed 500 Internal Server Error in 3ms

ActiveRecord::StatementInvalid (Mysql::Error: Table 'project.users' doesn't exist: SHOW FIELDS FROM `users`):
  app/models/user.rb:61:in `authenticate_with_salt'
  app/helpers/sessions_helper.rb:50:in `user_from_remember_token'
  app/helpers/sessions_helper.rb:13:in `current_user'
  app/helpers/sessions_helper.rb:17:in `signed_in?'
  app/controllers/pages_controller.rb:5:in `home'

So the problem seems to be that the app loads, but the DB isn't populated with tables and data.

I'm sure I'm missing a relatively basic detail of the deployment process, but thus far it escapes me... Any help would be mucho appreciated! Thanks.

Était-ce utile?

La solution

What does your Capfile look like?

Neither Rails nor Capistrano will copy data from your development environment to your deployment environment—db:migrate:* and db:schema:* only handle database structure. Before using rake db:schema:load make sure your development environment migrations have been run and your latest db/schema.rb is checked in to your repo.

If you want certain data to be in your database upon deployment look in db/seeds.rb. There are also many gems for seeding database data.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top