Sha256: 5013a4770522a518dc164949e577f5ad0387bf9b8e28fd18603c63bfcd45e52f
Contents?: true
Size: 667 Bytes
Versions: 3
Compression:
Stored size: 667 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| merge_errors!(klass) unless klass.send(action) klass end end def create_and_return!(klass, params) klass = klass.create(params) merge_errors!(klass) unless klass.errors.empty? klass end def update_and_return!(klass, params) merge_errors!(klass) unless klass.update(params) klass end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
lite-form-1.0.4 | lib/lite/form/helpers/propagation.rb |
lite-form-1.0.3 | lib/lite/form/helpers/propagation.rb |
lite-form-1.0.2 | lib/lite/form/helpers/propagation.rb |