HTTPS clone URL
Subversion checkout URL
EnvironmentalSeeder is a simple addition to db:seed to allow loading environment specific data through seeds.rb without any programming.
|Failed to load latest commit information.|
|README.es||Added readme in spanish|
EnvironmentalSeeder =================== EnvironmentalSeeder is a simple addition to db:seed to allow loading environment specific data through seeds.rb without any programming. Take in account that this task doesn't replace the existing one, just appends the environmental specific seed loading. Installation ============ Install it just as any other rails plugin $ script/plugin install git://github.com/franciscotufro/environmental_seeder.git Example ======= Just use seeds.rb to store the data that goes into every single environment and use db/seeds/[RAILS_ENV].rb for specific environment data to be loaded. For example, a default admin user that should be created on every environment should be put into seeds.rb db/seeds.rb -------- User.create(:login => 'admin', :password => 'secret', :password_confirmation => 'secret') Then, if you want your staging environment to have one post written by admin db/seeds/staging.rb ---------------- admin = User.find_by_login('admin') Post.create(:title => "Some data to populate staging environment", :author => admin) Now, if you run $ RAILS_ENV=staging rake db:seed Loading db/seeds/staging.rb That's all, you'll have your staging database populated with the admin user and a post, hope you enjoy it! Copyright (c) 2009 Francisco Tufró, released under the MIT license