tramway-core 1.18 → 1.18.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/forms/tramway/core/application_form.rb +8 -4
- data/app/forms/tramway/core/application_forms/association_object_helpers.rb +2 -2
- data/app/forms/tramway/core/application_forms/submit_helper.rb +4 -1
- data/app/forms/tramway/core/extendable_forms_helpers/class_builder.rb +1 -1
- data/app/forms/tramway/core/extendable_forms_helpers/more_properties_helper.rb +6 -2
- data/app/uploaders/photo_uploader.rb +1 -1
- 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: bc1dd51b28f3431c8df5cd27f8350d7dc2b4bedcf7a811c48130a9eb8d1d207b
|
4
|
+
data.tar.gz: fe2291fcb3bc27d9de9ebe3753ea493ef99a19ebb49db88fcf6e3b9917b2c6be
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 63428cee65707e287d8abb8e2d110f1b83342213a14d43f77bebb20530a9fb0765bd81d4659360a258f59d6597e32120d415ee80a508c9abb4bc49681d357b20
|
7
|
+
data.tar.gz: 3d597d30be2064ece9c9d7520964445868349ab8c924400f5f944fe18abade3efb673a1026ebc5dc576b178900ee4831682aff7a51e38f23c8bfd056cc2b03e3
|
@@ -39,11 +39,15 @@ class Tramway::Core::ApplicationForm
|
|
39
39
|
delegate :defined_enums, to: :model_class
|
40
40
|
|
41
41
|
def properties(*props)
|
42
|
+
props.each { |prop| property prop }
|
43
|
+
end
|
44
|
+
|
45
|
+
def property(prop)
|
42
46
|
@@properties ||= []
|
43
|
-
@@properties
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
+
@@properties << prop
|
48
|
+
delegate prop, to: :model
|
49
|
+
define_method("#{prop}=") do |value|
|
50
|
+
model.send "#{prop}=", value
|
47
51
|
end
|
48
52
|
end
|
49
53
|
|
@@ -7,7 +7,7 @@ module Tramway::Core::ApplicationForms::AssociationObjectHelpers
|
|
7
7
|
else
|
8
8
|
self.class.send(:define_method, "#{association}=") do |value|
|
9
9
|
model.send "#{association}_id=", value
|
10
|
-
|
10
|
+
model.send "#{association}=", class_name.find(value)
|
11
11
|
end
|
12
12
|
end
|
13
13
|
end
|
@@ -20,7 +20,7 @@ module Tramway::Core::ApplicationForms::AssociationObjectHelpers
|
|
20
20
|
Tramway::Error.raise_error :tramway, :core, :application_form, :initialize, :polymorphic_class_is_nil,
|
21
21
|
association_name: association
|
22
22
|
else
|
23
|
-
|
23
|
+
model.send "#{association}=", association_class.find(value.split('_')[-1])
|
24
24
|
send "#{association}_type=", association_class.to_s
|
25
25
|
end
|
26
26
|
end
|
@@ -4,7 +4,10 @@ module Tramway::Core::ApplicationForms::SubmitHelper
|
|
4
4
|
def submit(params)
|
5
5
|
if params
|
6
6
|
params.each { |key, value| send("#{key}=", value) }
|
7
|
-
|
7
|
+
result = save
|
8
|
+
result.tap do
|
9
|
+
collecting_associations_errors unless result
|
10
|
+
end
|
8
11
|
else
|
9
12
|
Tramway::Error.raise_error(:tramway, :core, :application_form, :submit, :params_should_not_be_nil)
|
10
13
|
end
|
@@ -24,7 +24,7 @@ module Tramway::Core::ExtendableFormsHelpers::ClassBuilder
|
|
24
24
|
field = property[1][:object]
|
25
25
|
define_file_property_assignment_method property, field
|
26
26
|
else
|
27
|
-
next unless property[1][:validates].present?
|
27
|
+
#next unless property[1][:validates].present?
|
28
28
|
|
29
29
|
define_assignment_method property
|
30
30
|
end
|
@@ -9,8 +9,12 @@ module Tramway::Core::ExtendableFormsHelpers::MorePropertiesHelper
|
|
9
9
|
|
10
10
|
def define_assignment_method(property)
|
11
11
|
define_method "#{property[0]}=" do |value|
|
12
|
-
property[1][:validates].
|
13
|
-
|
12
|
+
if property[1][:validates].present?
|
13
|
+
property[1][:validates].each do |pair|
|
14
|
+
make_validates property[0], pair, value
|
15
|
+
end
|
16
|
+
else
|
17
|
+
model.values.merge property[0] => value
|
14
18
|
end
|
15
19
|
end
|
16
20
|
end
|
data/lib/tramway/core/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tramway-core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 1.18.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Pavel Kalashnikov
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2020-04-
|
12
|
+
date: 2020-04-24 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: audited
|