Method: ConfigScripts::Seeds::SeedType#initialize
- Defined in:
- lib/config_scripts/seeds/seed_type.rb
#initialize(seed_set, klass, filename, &block) ⇒ SeedType
This method creates a new seed type.
This method should be given a block, which will be run in the instance context of the new seed type. That block should use the DSL methods to fill in the details for the seed type.
75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 |
# File 'lib/config_scripts/seeds/seed_type.rb', line 75 def initialize(seed_set, klass, filename, &block) @seed_set = seed_set @klass = klass @filename = filename @attributes = [] @identifier_attributes = [:id] @scopes = [] @dynamic_writers = {} @dynamic_readers = {} @associations = {} @klass.reflect_on_all_associations.each do |association| @associations[association.name] = association.klass rescue nil end self.instance_eval(&block) if block_given? end |