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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 57bc94fcad00f60e39f4b5eb62b9c959a0739d3063d9ee3017349c9ef8e91c04
4
- data.tar.gz: 4b11029d70b3dd9f45bfc7ec4e73fc8fb4b3f9ae60eec90756431ab92d611aa7
3
+ metadata.gz: bc1dd51b28f3431c8df5cd27f8350d7dc2b4bedcf7a811c48130a9eb8d1d207b
4
+ data.tar.gz: fe2291fcb3bc27d9de9ebe3753ea493ef99a19ebb49db88fcf6e3b9917b2c6be
5
5
  SHA512:
6
- metadata.gz: 6955a32c4a63a19ea949694636d64b7725aa571fc601e213276e67555ac8300bea5bbff4ca3c9337eeba9e8001dcf40b4b9dda4ca6e7bb6f0ab1d2d1d13cb2f5
7
- data.tar.gz: cad297b01c90cff4e6a66048cec29e39faba8744ec4148ddf6d1e1fcf80775974bc361414ea8dc05c4788749e87d8cef5ec39832dc150d32e9f80704b8d4d100
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 += props
44
- props.each do |prop|
45
- delegate prop, to: :model
46
- define_method("#{prop}=") { |value| model.send "#{prop}=", value }
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
- super class_name.find value
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
- super association_class.find value.split('_')[-1]
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
- save || collecting_associations_errors
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].each do |pair|
13
- make_validates property[0], pair, value
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
@@ -4,7 +4,7 @@ class PhotoUploader < ApplicationUploader
4
4
  include ImageDefaults
5
5
 
6
6
  def default_url
7
- ActionController::Base.helpers.asset_path('images/default_photo.png')
7
+ ActionController::Base.helpers.asset_path('mona_lisa_from_prado_square.png')
8
8
  end
9
9
 
10
10
  def url
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Tramway
4
4
  module Core
5
- VERSION = '1.18'
5
+ VERSION = '1.18.0.1'
6
6
  end
7
7
  end
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: '1.18'
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-23 00:00:00.000000000 Z
12
+ date: 2020-04-24 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: audited