Method: ConfigScripts::Seeds::SeedType#read_value_for_association
- Defined in:
- lib/config_scripts/seeds/seed_type.rb
#read_value_for_association(attribute, identifier) ⇒ ActiveRecord::Base
This method gets the value that we will assign to an attribute for an association.
This will remove as many entries from the identifier as it needs to get the value.
303 304 305 306 307 308 309 310 |
# File 'lib/config_scripts/seeds/seed_type.rb', line 303 def read_value_for_association(attribute, identifier) klass = @associations[attribute] unless klass class_name = identifier.shift klass = class_name.constantize end value = self.seed_set.record_for_seed_identifier(klass, identifier) end |