tramway-core 1.14.1 → 1.14.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/app/forms/tramway/core/application_form.rb +29 -2
- data/lib/tramway/core/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 18a93e1530863c7ddb15e6adb573d5ea06aae29357eabdf06ed433dc9e170cc6
|
4
|
+
data.tar.gz: 8066187cef4863fa4f7a830d90a90ed78afffb2aa29fef32760b5037d07da38c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d05a35d45517d87b4d25908edc824e07aedaea45ec617c7b296131104cb6d9435e3b1fcf60ba38e1594cc9ac570bc913910d797c74614d2916e72f60f45b43c0
|
7
|
+
data.tar.gz: 8554ecb444b5c84a819ee6fc4a8cd28bca1c250a39eb4113481bb788180bd1e6636d0e309e9542be054568f45d738e8d5cc4ad09d01320f896bfa425c8d211a7
|
@@ -32,7 +32,23 @@ module Tramway::Core
|
|
32
32
|
|
33
33
|
def submit(params)
|
34
34
|
if params
|
35
|
-
|
35
|
+
if validate params
|
36
|
+
begin
|
37
|
+
save
|
38
|
+
rescue StandardError => e
|
39
|
+
error = Tramway::Error.new(plugin: :core, method: :submit, message: "Looks like you have method `#{e.name.to_s.gsub('=', '')}` in #{@@model_class}. You should rename it or rename property in #{self.class}")
|
40
|
+
raise error.message
|
41
|
+
end
|
42
|
+
else
|
43
|
+
association_error = false
|
44
|
+
@@associations.each do |association|
|
45
|
+
if errors.details[association] == [{ error: :blank }]
|
46
|
+
model.send("#{association}=", send(association))
|
47
|
+
association_error = true
|
48
|
+
end
|
49
|
+
end
|
50
|
+
association_error && save
|
51
|
+
end
|
36
52
|
else
|
37
53
|
error = Tramway::Error.new(plugin: :core, method: :submit, message: 'ApplicationForm::Params should not be nil')
|
38
54
|
raise error.message
|
@@ -47,9 +63,20 @@ module Tramway::Core
|
|
47
63
|
@form_properties = args
|
48
64
|
end
|
49
65
|
|
66
|
+
def form_properties_additional(**args)
|
67
|
+
@form_properties_additional = args
|
68
|
+
end
|
69
|
+
|
50
70
|
def properties
|
51
71
|
return @form_properties if @form_properties
|
52
|
-
|
72
|
+
yaml_config_file_path = Rails.root.join('app', 'forms', "#{self.class.name.underscore}.yml")
|
73
|
+
if File.exist? yaml_config_file_path
|
74
|
+
@form_properties = YAML.load_file(yaml_config_file_path).deep_symbolize_keys
|
75
|
+
@form_properties.deep_merge! @form_properties_additional if @form_properties_additional
|
76
|
+
@form_properties
|
77
|
+
else
|
78
|
+
[]
|
79
|
+
end
|
53
80
|
end
|
54
81
|
|
55
82
|
def build_errors; end
|
data/lib/tramway/core/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tramway-core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.14.
|
4
|
+
version: 1.14.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Pavel Kalashnikov
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-11-
|
11
|
+
date: 2019-11-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: audited
|