Class: RecordLoader::TransferTemplateLoader
- Inherits:
-
ApplicationRecordLoader
- Object
- Base
- ApplicationRecordLoader
- RecordLoader::TransferTemplateLoader
- Defined in:
- lib/record_loader/transfer_template_loader.rb
Overview
Creates transfer templates if they are not present
Instance Method Summary collapse
Methods inherited from ApplicationRecordLoader
Instance Method Details
#create_or_update!(name, options) ⇒ Object
11 12 13 14 15 16 17 18 |
# File 'lib/record_loader/transfer_template_loader.rb', line 11 def create_or_update!(name, ) # We do not use the following because it creates a new record only. # TransferTemplate.create_with(options).find_or_create_by!(name: name) # We use the following because it creates a new record or updates existing. transfer_template = TransferTemplate.find_or_initialize_by(name:) transfer_template.update!() # assign_attributes and save! end |