How to seed the production database using the Capistrano gem?

后端 未结 6 1981
不思量自难忘°
不思量自难忘° 2021-01-30 01:47

I am using Ruby on Rails 3.0.9 and I would like to seed the production database in order to add some record without re-building all the database (that is, with

6条回答
  •  陌清茗
    陌清茗 (楼主)
    2021-01-30 02:23

    This worked for me:

    task :seed do
     puts "\n=== Seeding Database ===\n"
     on primary :db do
      within current_path do
        with rails_env: fetch(:stage) do
          execute :rake, 'db:seed'
        end
      end
     end
    end
    

    capistrano 3, Rails 4

提交回复
热议问题