Method: StandardModel::ClassMethods#find_or_create_by_and_log!
- Defined in:
- lib/app/models/concerns/standard_model.rb
#find_or_create_by_and_log!(user, attributes) ⇒ Object
Find or create by filter, the log the action
90 91 92 93 94 95 |
# File 'lib/app/models/concerns/standard_model.rb', line 90 def find_or_create_by_and_log!(user, attributes) model = find_or_initialize_by(attributes) log_change(user, model, attributes) if model.new_record? && model.valid? model.save! model end |