How to seed the production database using the Capistrano gem?

If you are using bundler, then the capistrano task should be:

namespace :deploy do
  desc "reload the database with seed data"
  task :seed do
    run "cd #{current_path}; bundle exec rake db:seed RAILS_ENV=#{rails_env}"
  end
end

and it might be placed in a separate file, such as lib/deploy/seed.rb and included in your deploy.rb file using following command:

load 'lib/deploy/seed'

Leave a Comment