Module: Tramway::Core::ApplicationForms::SubmitHelper
- Included in:
- Tramway::Core::ApplicationForm
- Defined in:
- app/forms/tramway/core/application_forms/submit_helper.rb
Instance Method Summary collapse
Instance Method Details
#save ⇒ Object
13 14 15 16 17 18 19 20 |
# File 'app/forms/tramway/core/application_forms/submit_helper.rb', line 13 def save model.save rescue ArgumentError => e Tramway::Error.raise_error :tramway, :core, :application_form, :save, :argument_error, message: e. rescue StandardError => e Tramway::Error.raise_error :tramway, :core, :application_form, :save, :looks_like_you_have_method, method_name: e.name.to_s.gsub('=', ''), model_class: @@model_class, class_name: self.class end |
#submit(params) ⇒ Object
4 5 6 7 8 9 10 11 |
# File 'app/forms/tramway/core/application_forms/submit_helper.rb', line 4 def submit(params) if params params.each { |key, value| send("#{key}=", value) } save || collecting_associations_errors else Tramway::Error.raise_error(:tramway, :core, :application_form, :submit, :params_should_not_be_nil) end end |