Class: Flexite::Entry::CreateService

Inherits:
ActionService show all
Defined in:
app/services/flexite/entry/create_service.rb

Instance Method Summary collapse

Methods inherited from ActionService

#initialize

Constructor Details

This class inherits a constructor from Flexite::ActionService

Instance Method Details

#callObject



6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'app/services/flexite/entry/create_service.rb', line 6

def call
  if @form.invalid?
    return failure
  end

  @record = @form.type.constantize.create do |record|
    record.value = @form.value
    record.parent_id = @form.parent_id
    record.parent_type = @form.parent_type
  end

  success
end