Class: ActiveRecord::Base
- Inherits:
-
Object
- Object
- ActiveRecord::Base
- Defined in:
- lib/seed-fu.rb
Class Method Summary collapse
-
.seed(*constraints, &block) ⇒ Object
Creates a single record of seed data for use with the db:seed rake task.
- .seed_many(*constraints) ⇒ Object
Class Method Details
.seed(*constraints, &block) ⇒ Object
Creates a single record of seed data for use with the db:seed rake task.
Parameters
- constraints
-
Immutable reference attributes. Defaults to :id
82 83 84 |
# File 'lib/seed-fu.rb', line 82 def self.seed(*constraints, &block) SeedFu::Seeder.plant(self, *constraints, &block) end |
.seed_many(*constraints) ⇒ Object
86 87 88 89 90 91 92 93 94 95 |
# File 'lib/seed-fu.rb', line 86 def self.seed_many(*constraints) seeds = constraints.pop seeds.each do |seed_data| seed(*constraints) do |s| seed_data.each_pair do |k,v| s.send "#{k}=", v end end end end |