Colonization
Gem for development database populating. Data seeding regarding to your models fields, their types and validations. It is in development now - only presence and acceptance validations currently supported.
Installation
Add this line to your application's Gemfile:
gem 'colonization'
And then execute:
$ bundle
Or install it yourself as:
$ gem install colonization
Usage
Add then following to seeds.rb file:
Colonization::Ship.new.colonize
That's all!
Customization
Add colonization.rb file to your initializers:
Colonization.configure do |config|
config.something = :something
config.seed_type = :default
config.seed_index = 4
config.count_of_instances_to_seed = 10
config.clear_table = true
end
List of currently allowed configurations:
seed_type:
currently 2 seed strategies are supported - :fixed and :default. Fixed strategy seeding fixed count of instances(user will be able to customize this for each model, it is in development now), by default it is 100. Default strategy populates database according to other configuration setting - :seed_index. By this strategy count of model instances will increase by geometric progression(from parent models to dependent), by default - 3.
seed_index: by default: 3
index according to model instances count increase(from parent model to child). E.g. Client has_many orders. With seed_index = 3 Client will have 100 instances, Order - up to 300 It is used only by default seed strategy
count_of_instances_to_seed: by_default: 100
Used by both strategies. For fixed strategy it means - accurate number of instances to create, for default strategy - instances count for top level model
clear_table: by_default: true
Clear or not table before seeding
Contributing
Bug reports and pull requests are welcome on GitHub at https://github.com/dongan2010/colonization.