Sha256: a68ff51ddc5e79a30bb9330a8ae468121dfb3fff438971bbc0ea8e2777435e43
Contents?: true
Size: 646 Bytes
Versions: 15
Compression:
Stored size: 646 Bytes
Contents
module Flexite class Config class UpdateService < ActionService def call if @form.invalid? return failure end @record = Config.joins(:entry) .select("#{Config.table_name}.*, #{Entry.table_name}.id AS entry_id") .where(id: @form.id).first @record.update_attributes(@form.attributes) success end protected def failure Result.new(success: false, endpoint: { action: :edit, status: 400 }) end def success Result.new(flash: { type: :success, message: 'Config was updated!' }, data: @record) end end end end
Version data entries
15 entries across 15 versions & 1 rubygems