Split your database seeds.rb by Rails environment


rails_app/db/seeds

touch development.rb test.rb production.rb




db/seeds.rb

puts Rails.env.downcase


# load the correct seeds file for our Rails environment
load(Rails.root.join( 'db', 'seeds', "#{ Rails.env.downcase}.rb"))

阅读量: 705
发布于:
修改于: