Sha256: de5aa9d23ac81a140a32f2e9585ea14a405c60da4afee64652048c064294dd1b
Contents?: true
Size: 804 Bytes
Versions: 1
Compression:
Stored size: 804 Bytes
Contents
# frozen_string_literal: true module Tramway::ApplicationForms::SubmitHelper def submit(params) if params params.each { |key, value| send("#{key}=", value) } result = save result.tap do collecting_associations_errors unless result end else Tramway::Error.raise_error(:application_form, :submit, :params_should_not_be_nil) end end def save model.save rescue ArgumentError => e Tramway::Error.raise_error :tramway, :application_form, :save, :argument_error, message: e.message rescue StandardError => e raise e unless e.try :name Tramway::Error.raise_error :tramway, :application_form, :save, :looks_like_you_have_method, method_name: e.name.to_s.gsub('=', ''), model_class: model.class, class_name: self.class end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
tramway-0.1.2 | app/forms/tramway/application_forms/submit_helper.rb |