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
76 77 78 |
# File 'lib/seed-fu.rb', line 76 def self.seed(*constraints, &block) SeedFu::Seeder.plant(self, *constraints, &block) end |
.seed_many(*constraints) ⇒ Object
80 81 82 83 84 85 86 87 88 89 |
# File 'lib/seed-fu.rb', line 80 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 |