slim_form_object 2.1.0 → 2.1.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
- SHA1:
3
- metadata.gz: 5117a69b875232f6d8bc23f95e09ff8b84e49f9d
4
- data.tar.gz: ceac637e0890c87c2eb25340f1f41c7f0054fcfb
2
+ SHA256:
3
+ metadata.gz: c45161b3e5ff7595beed3c8d14018f198865a52597132f15097ab3919749ab22
4
+ data.tar.gz: 4bf8993afe2245a82f9d4b621eeb5e1b0c2b1c842af38a76a4cfda15edb70499
5
5
  SHA512:
6
- metadata.gz: aa2987d5ce904144c14c0e09b791599a0bc012136f081233dabcf81280356d7e76bfca1adeae98a52001bcad1fd585397dcddb6e496edea4160b10ef97a05613
7
- data.tar.gz: ef5e893bdb0fd7d491fd50bbc421ae925c4aec47290a2348a6073944b0721224230af95712266bd82ec37abfb869fb67c0b6e5a6e30abe7163b1ab24b1a2adc9
6
+ metadata.gz: 31790ab04d162b9254777a81969e1f94496ea70941e49198f58fa6311a05da396a22c50169084bc58c92e3641f6e05d2bf4af92753da136cdac780338f2dcf4a
7
+ data.tar.gz: 7d6239db839ebf37cdd8839bb83e6d1b99c0f64d2d240c7391b5abab5ff83949ecfbbb8b862e0bd30d2705aacf5e86a41a37af1ab13856604b1313be2d35909f
@@ -8,7 +8,6 @@ module SlimFormObject
8
8
  @form_object = form_object
9
9
  @base_module = form_object.class.base_module
10
10
  @params = form_object.params
11
- @array_all_objects_for_save = form_object.array_all_objects_for_save
12
11
  @validator = Validator.new(form_object)
13
12
  @data_for_save = []
14
13
  end
@@ -111,10 +111,26 @@ module ActionView
111
111
  include HelperMethods
112
112
 
113
113
  private
114
-
115
- def value(object)
116
- method_name = @options[:sfo_nested] ? apply_expression_text(@method_name)[1] : sfo_get_method_name(@method_name)
117
- object.public_send method_name if object
114
+
115
+ # TODO: Find a better way to solve this issue!
116
+ # This patch is needed since this Rails commit:
117
+ # https://github.com/rails/rails/commit/c1a118a
118
+ if defined? ::ActiveRecord
119
+ if ::ActiveRecord::VERSION::STRING < '5.2'
120
+ def value(object)
121
+ method_name = @options[:sfo_nested] ? apply_expression_text(@method_name)[1] : sfo_get_method_name(@method_name)
122
+ object.send method_name if object # use send instead of public_send
123
+ end
124
+ else # rails/rails#29791
125
+ def value
126
+ method_name = @options[:sfo_nested] ? apply_expression_text(@method_name)[1] : sfo_get_method_name(@method_name)
127
+ if @allow_method_names_outside_object
128
+ object.send method_name if object && object.respond_to?(@method_name, true)
129
+ else
130
+ object.send method_name if object
131
+ end
132
+ end
133
+ end
118
134
  end
119
135
 
120
136
  def tag_name(multiple = false, index = nil)
@@ -4,7 +4,7 @@ module SlimFormObject
4
4
  include ::HelperMethods
5
5
  extend ::HelperMethods
6
6
 
7
- attr_accessor :params, :array_objects_for_save, :data_for_save
7
+ attr_accessor :params, :data_for_save
8
8
 
9
9
  class << self
10
10
  attr_accessor :base_module
@@ -91,10 +91,6 @@ module SlimFormObject
91
91
  Validator.new(self).validate_form_object
92
92
  end
93
93
 
94
- def array_all_objects_for_save
95
- array_objects_for_save ||= get_or_add_default_objects
96
- end
97
-
98
94
  private
99
95
 
100
96
  def require_extensions
@@ -1,3 +1,3 @@
1
1
  module SlimFormObject
2
- VERSION = "2.1.0"
2
+ VERSION = "2.1.1"
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: 2.1.0
4
+ version: 2.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - woodcrust
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-10-14 00:00:00.000000000 Z
11
+ date: 2019-01-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activemodel
@@ -199,8 +199,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
199
199
  - !ruby/object:Gem::Version
200
200
  version: '0'
201
201
  requirements: []
202
- rubyforge_project:
203
- rubygems_version: 2.6.12
202
+ rubygems_version: 3.0.1
204
203
  signing_key:
205
204
  specification_version: 4
206
205
  summary: This is form object