slim_form_object 3.1.0 → 3.2.0

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: 5c312bc3e24f891d533dd197c4b064a676b6bf18fd4f5c7d655830462e2c0d1b
4
- data.tar.gz: cb1d25b857e75dd4b85021c348be78fb23ca16fcb263dbf68da5c3538eabc805
3
+ metadata.gz: f7789745013fc14bc053cbfce3982ecfbaac028d925135abd6ac4729129746df
4
+ data.tar.gz: 2c679b2b95f1abccd9371b2b8502ff3dffbbf2c30b5588b619e07ffd528dbfe0
5
5
  SHA512:
6
- metadata.gz: 7f23ff7c1c057e3b662dfe0c506476db9fb978f939b05c2825cf3d3ab32742f34587c493c9d7eeb8b83c3e125dd0f623e0044c956eb9cba8ed506210ed59beb3
7
- data.tar.gz: 8e29fadfdf6d4a153296161eb062bc6bc44582f02caeb4dba8083cc11e684b7d68fae19f8e659cc109f7fd98442d083941ab43f080cc74d8e439b5fe5984c7c2
6
+ metadata.gz: 56c1956ea98aa65d6f6d1ac159815ff947966550a21610ecea271bf7a19fa049fe38bee7599a8a9dd52dc4531d9c2923619da833280004807c7e5e08df892709
7
+ data.tar.gz: 6b8e22e5b95f2f246cba5f80caf9aeb22bbe27c53173bbe712a252ae11a9dfbd5a830f02edf551a2cf36d55b5123051e4e22987d5d9945b482e5e16e99345b0b
@@ -39,7 +39,7 @@ module SlimFormObject
39
39
  # }
40
40
  # ]
41
41
  def make_hash_objects_and_nested_objects(key_params, value_params)
42
- model = get_class_of(key_params)
42
+ model = get_class_of(key_params, form_object.base_modules[key_params.to_sym])
43
43
  attributes = {}
44
44
  nested = []
45
45
 
@@ -7,7 +7,7 @@ module SlimFormObject
7
7
 
8
8
  def initialize(name: nil, attributes: {}, form_object: nil)
9
9
  @name = name
10
- @model = get_class_of(name)
10
+ @model = get_class_of(name, form_object&.base_modules[name&.to_sym])
11
11
  @attributes = attributes
12
12
  @form_object = form_object
13
13
  @object = make_object
@@ -4,10 +4,10 @@ module SlimFormObject
4
4
  include ::HelperMethods
5
5
  extend ::HelperMethods
6
6
 
7
- attr_accessor :params, :data_objects_arr
7
+ attr_accessor :params, :data_objects_arr, :base_modules
8
8
 
9
9
  class << self
10
- attr_accessor :base_module
10
+ attr_accessor :base_modules
11
11
 
12
12
  def set_model_name(name)
13
13
  define_method(:model_name) { ActiveModel::Name.new(self, nil, name) }
@@ -43,7 +43,7 @@ module SlimFormObject
43
43
 
44
44
  def get_main_models_from_structure(structure)
45
45
  structure.keys.map do |main_model_name|
46
- get_class_of(main_model_name)
46
+ get_class_of(main_model_name, base_modules[main_model_name])
47
47
  end
48
48
  end
49
49
 
@@ -79,7 +79,8 @@ module SlimFormObject
79
79
 
80
80
  def initialize(params: {})
81
81
  require_extensions
82
- self.params = params
82
+ self.base_modules = self.class.base_modules
83
+ self.params = params
83
84
  get_or_add_default_objects
84
85
  default_settings
85
86
  end
@@ -140,7 +141,8 @@ module SlimFormObject
140
141
  end unless respond_to?(:allow_to_save_object_block)
141
142
 
142
143
  define_singleton_method(:allow_object_processing_block) do
143
- Proc.new { |data_object| data_object.blank_or_empty? }
144
+ # Proc.new { |data_object| data_object.blank_or_empty? }
145
+ Proc.new { |data_object| true }
144
146
  end unless respond_to?(:allow_object_processing_block)
145
147
  end
146
148
 
@@ -1,3 +1,3 @@
1
1
  module SlimFormObject
2
- VERSION = "3.1.0"
2
+ VERSION = "3.2.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: slim_form_object
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.1.0
4
+ version: 3.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - woodcrust
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-01-22 00:00:00.000000000 Z
11
+ date: 2019-02-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activemodel