- The first
model
argument is the model class - The second argument
find_or_create_by
is 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_with
is 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.
seed User, { email: '[email protected]' }, {
password: 'asdfasdf',
roles: [:admin],
first_name: 'John',
last_name: 'Doe'
}
This is great! thanks