Method: StandardModel::ClassMethods#create_and_log

Defined in:
lib/app/models/concerns/standard_model.rb

#create_and_log(user, attributes) ⇒ Object

Record the creation with this user



100
101
102
103
104
105
106
107
# File 'lib/app/models/concerns/standard_model.rb', line 100

def create_and_log(user, attributes)
  model = create(attributes)
  model.last_modified_by = user
  model.created_by = user
  model.save
  log_change(user, model, attributes) if model.valid?
  model
end