Sha256: b56d79671e602def3d60153ec2a16cf1ae3c968e74a309578e474577a6210ada
Contents?: true
Size: 596 Bytes
Versions: 18
Compression:
Stored size: 596 Bytes
Contents
require_dependency 'flexite/action_service' module Flexite class Entry::UpdateService < ActionService def call if @form.invalid? return failure end record = @form.type.constantize.find(@form.id) record.value = @form.value if record.changed? record.save end success end private protected def failure save_errors Result.new(success: false, endpoint: { action: :edit, status: 400 }) end def success Result.new(flash: { type: :success, message: 'Entry was updated!' }) end end end
Version data entries
18 entries across 18 versions & 1 rubygems