rbranson / spread

Spread runs seeds

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

spread

Spread is a simple way to run seed data based on the current Rails environment. Simply create a seeds/ directory under db/ and put your environment-specific seeds in there. Name each file the name of the environment followed by .rb. To load these seeds, simply add a call to Spread.load to your seeds.rb file. If you have a more complex environment, use the seed method to tell Spread to load certain seed files for certain environments. HINT: This can also be used to break your seed files out and organize them.

Using :all as an environment will cause Spread to apply the settings to all environments.

Spread.seed

Tells Spread to load a seed file for a specific environment. Spread is smart enough not to load a seed more than once. This method takes a hash parameter and uses the keys as the seed file and the value(s) as the environment to load this seed file in.

Spread.seed :production => :testing
Spread.seed :flinstones => [ :production, :development, :testing, :staging ]
Spread.seed :scooby => :production, :velma => :staging

Spread.any

Tells Spread to load any seeds for the specified environment within other environment(s). This is a good for scenarios in which you’d like to mimick your production environment.

Spread.any :production => :staging
Spread.any :production => [ :staging, :preproduction ]

Spread.load

Performs the actual loading of seed files setup in Spread. Add this to your seeds.rb file to invoke it.

About

Spread runs seeds

License:MIT License


Languages

Language:Ruby 100.0%