Sha256: 6affcdfff833eeeca1e87768d07c8f893d1c1469968f94d7b8e210f6664a6f7e
Contents?: true
Size: 674 Bytes
Versions: 1
Compression:
Stored size: 674 Bytes
Contents
# frozen_string_literal: true module Lite module Form module Helpers module Propagation private %i[archive destroy save].each do |action| define_method("#{action}_and_return!") do |klass| errors.merge!(klass.errors) unless klass.send(action) klass end end def create_and_return!(klass, params) klass = klass.create(params) errors.merge!(klass.errors) unless klass klass end def update_and_return!(klass, params) errors.merge!(klass.errors) unless klass.update(params) klass end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
lite-form-1.0.0 | lib/lite/form/helpers/propagation.rb |