Method: ConfigScripts::Seeds::SeedType#read_value_for_attribute
- Defined in:
- lib/config_scripts/seeds/seed_type.rb
#read_value_for_attribute(value, attribute) ⇒ Object
This method takes a value from the CSV file and gives back the value that should be set on the record.
If the attribute is an association, this will pass it to the seed set as a seed identifier. If it is a polymorphic association, it will use the first part of the seed identifier as a class name.
278 279 280 281 282 283 284 285 286 287 288 |
# File 'lib/config_scripts/seeds/seed_type.rb', line 278 def read_value_for_attribute(value, attribute) if @dynamic_readers[attribute] value = @dynamic_readers[attribute].call(value) end if @associations.has_key?(attribute) return nil if value.blank? value = self.read_value_for_association(attribute, value.split("::")) end value end |