Idempotent seed helper for rails
- The first
modelargument is the model class
- The second argument
find_or_create_byis a hash of attributes that are used for finding a record. If the record doesn't exist, it will be created. This hash is like the unique identifier of a seed record.
- The third argument
update_withis a hash of attributes that will be always set on the record, whether the record already exists or has to be created. This is useful when the seeds are extended and you want to update existing records with new attributes.