Method: ConfigScripts::Seeds::SeedType#when_writing

Defined in:
lib/config_scripts/seeds/seed_type.rb

#when_writing(attribute, &block) ⇒ Object

This method registers a custom block that will be run when writing a value to the seed file.

This method takes a block that will be run on the item whose values we are writing. The return value of the block will be used instead of running the method on the record.

Parameters:

  • attribute (Symbol)

    The attribute we are writing.



156
157
158
# File 'lib/config_scripts/seeds/seed_type.rb', line 156

def when_writing(attribute, &block)
  @dynamic_writers[attribute] = block
end