reform-rails 0.2.4 → 0.2.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGES.md +8 -0
- data/Gemfile +1 -1
- data/lib/reform/form/active_model/validations.rb +4 -4
- data/lib/reform/form/active_model.rb +5 -2
- data/lib/reform/rails/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e32ac394ac02ea272b9a31655ca20b65253b8a417b0f716c7f1eda516c25981b
|
4
|
+
data.tar.gz: 7e520b5e80f4669f289bccaaa8cb5f3c549123d242e42a31e52f0be6e1f1086f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7b433bafad6faa28202c8a246c334fa2c7c41c735196b66f98353a9bf614990960278a2dccc87203a9985ad05e09077986795d7007e7d674e9938de3886c683d
|
7
|
+
data.tar.gz: 63f646b6f6bac1062176f84da317f05d0a44e58b0c9f3e9f5bfeb8573ceb25d2e659f84561ff831ee593f4f770494e991f49b046948036a67aa87eb2ab08b472
|
data/CHANGES.md
CHANGED
@@ -1,3 +1,11 @@
|
|
1
|
+
# 0.2.6
|
2
|
+
|
3
|
+
* Allow to override `#persisted?` and friends with modules.
|
4
|
+
|
5
|
+
# 0.2.5
|
6
|
+
|
7
|
+
* Fix: Delegating from form object causes ArgumentError with 0.2.4 (https://github.com/trailblazer/reform-rails/issues/99)
|
8
|
+
|
1
9
|
# 0.2.4
|
2
10
|
|
3
11
|
* Fix keyword argument warning in `method_missing` (https://github.com/trailblazer/reform-rails/pull/97)
|
data/Gemfile
CHANGED
@@ -141,9 +141,9 @@ module Reform
|
|
141
141
|
messages.to_s
|
142
142
|
end
|
143
143
|
|
144
|
-
def add(key, error_text)
|
144
|
+
def add(key, error_text, **error_options)
|
145
145
|
# use rails magic to get the correct error_text and make sure we still update details and fields
|
146
|
-
error = @amv_errors.add(key, error_text)
|
146
|
+
error = @amv_errors.add(key, error_text, **error_options)
|
147
147
|
error = [error.message] unless error.is_a?(Array)
|
148
148
|
|
149
149
|
# using error_text instead of text to either keep the symbol which will be
|
@@ -171,12 +171,12 @@ module Reform
|
|
171
171
|
base_errors = @amv_errors.full_messages
|
172
172
|
form_fields = @amv_errors.instance_variable_get(:@base).instance_variable_get(:@fields)
|
173
173
|
nested_errors = full_messages_for_nested_fields(form_fields)
|
174
|
-
|
174
|
+
|
175
175
|
[base_errors, nested_errors].flatten.compact
|
176
176
|
end
|
177
177
|
|
178
178
|
private
|
179
|
-
|
179
|
+
|
180
180
|
def full_messages_for_nested_fields(form_fields)
|
181
181
|
form_fields.map { |field| full_messages_for_twin(field[1]) }
|
182
182
|
end
|
@@ -4,8 +4,11 @@ module Reform::Form::ActiveModel
|
|
4
4
|
extend ClassMethods
|
5
5
|
register_feature ActiveModel
|
6
6
|
|
7
|
-
|
8
|
-
|
7
|
+
delegations = Module.new do
|
8
|
+
delegate :persisted?, :to_key, :to_param, :id, to: :model
|
9
|
+
end
|
10
|
+
|
11
|
+
include delegations # now, those methods (e.g. {#persisted?}) can be overridden by another module.
|
9
12
|
|
10
13
|
def to_model # this is called somewhere in FormBuilder and ActionController.
|
11
14
|
self
|
data/lib/reform/rails/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: reform-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nick Sutterer
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-08-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: reform
|
@@ -95,7 +95,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '0'
|
97
97
|
requirements: []
|
98
|
-
rubygems_version: 3.
|
98
|
+
rubygems_version: 3.2.3
|
99
99
|
signing_key:
|
100
100
|
specification_version: 4
|
101
101
|
summary: Automatically load and include all common Rails form features.
|