Class: ProtectedRecord::UseCase::ChangeFilter::Create

Inherits:
Object
  • Object
show all
Includes:
PayDirt::UseCase
Defined in:
lib/protected_record/use_case/change_filter/create.rb

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ Create

Returns a new instance of Create.



6
7
8
9
# File 'lib/protected_record/use_case/change_filter/create.rb', line 6

def initialize(options)
  load_options(:protected_record, options)
  validate_state
end

Instance Method Details

#execute!Object



11
12
13
14
15
16
17
# File 'lib/protected_record/use_case/change_filter/create.rb', line 11

def execute!
  if @protected_record.changes.present?
    revert_protected_attrs
  end

  return PayDirt::Result.new(data: { change_request_record: @protected_record }, success: true)
end