yaaf 0.1.1 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/lib/yaaf/form.rb +13 -2
- data/lib/yaaf/version.rb +1 -1
- metadata +7 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3a1722cf68a3ac8c7aa91f75205ff4885bae7a94fbf8764c94c2b0466959174a
|
4
|
+
data.tar.gz: d35126b6b21dbd8e57fa67090ba8802323f4adbd61514cb50b0002adb48e2987
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 64ef092463adeacde6d6a4dd42c660ae005255de36ec6df071575d08086029dd6bd62bd212eba4add212eb437c402edb8f083758e3b1a7d4a61e628ec978d94b
|
7
|
+
data.tar.gz: 26cda08a6ef4ad7dc741ade6ddce45e77720ecf979a9e788492c471ba486ed09b8a4791e81acaf3ac3ed8da875b5483928145ceec5e69c04060cdcb47f94ff41
|
data/README.md
CHANGED
@@ -113,7 +113,7 @@ class RegistrationsController < ApplicationController
|
|
113
113
|
registration_form = RegistrationForm.new(user_attributes: user_params)
|
114
114
|
|
115
115
|
if registration_form.save
|
116
|
-
redirect_to
|
116
|
+
redirect_to registration_form.user
|
117
117
|
else
|
118
118
|
render :new
|
119
119
|
end
|
data/lib/yaaf/form.rb
CHANGED
@@ -31,8 +31,14 @@ module YAAF
|
|
31
31
|
attr_accessor :models
|
32
32
|
|
33
33
|
def promote_errors(model)
|
34
|
-
|
35
|
-
errors.
|
34
|
+
if rails_version_less_than_6_1?
|
35
|
+
model.errors.each do |attribute, message|
|
36
|
+
errors.add(attribute, message)
|
37
|
+
end
|
38
|
+
else
|
39
|
+
model.errors.each do |model_error|
|
40
|
+
errors.add(model_error.attribute, model_error.message)
|
41
|
+
end
|
36
42
|
end
|
37
43
|
end
|
38
44
|
|
@@ -60,5 +66,10 @@ module YAAF
|
|
60
66
|
run_callbacks :rollback
|
61
67
|
raise exception
|
62
68
|
end
|
69
|
+
|
70
|
+
def rails_version_less_than_6_1?
|
71
|
+
ActiveModel::VERSION::MAJOR < 6 ||
|
72
|
+
ActiveModel::VERSION::MAJOR == 6 && ActiveModel::VERSION::MINOR.zero?
|
73
|
+
end
|
63
74
|
end
|
64
75
|
end
|
data/lib/yaaf/version.rb
CHANGED
metadata
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: yaaf
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Juan Manuel Ramallo
|
8
8
|
- Santiago Bartesaghi
|
9
|
-
autorequire:
|
9
|
+
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2021-01-28 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activemodel
|
@@ -149,7 +149,7 @@ dependencies:
|
|
149
149
|
- - "~>"
|
150
150
|
- !ruby/object:Gem::Version
|
151
151
|
version: 1.4.2
|
152
|
-
description:
|
152
|
+
description:
|
153
153
|
email:
|
154
154
|
- juan.ramallo@rootstrap.com
|
155
155
|
executables: []
|
@@ -167,7 +167,7 @@ licenses:
|
|
167
167
|
metadata:
|
168
168
|
homepage_uri: https://github.com/rootstrap/yaaf
|
169
169
|
source_code_uri: https://github.com/rootstrap/yaaf
|
170
|
-
post_install_message:
|
170
|
+
post_install_message:
|
171
171
|
rdoc_options: []
|
172
172
|
require_paths:
|
173
173
|
- lib
|
@@ -182,8 +182,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
182
182
|
- !ruby/object:Gem::Version
|
183
183
|
version: '0'
|
184
184
|
requirements: []
|
185
|
-
rubygems_version: 3.
|
186
|
-
signing_key:
|
185
|
+
rubygems_version: 3.2.0.rc.1
|
186
|
+
signing_key:
|
187
187
|
specification_version: 4
|
188
188
|
summary: Easing the form object pattern in Rails applications.
|
189
189
|
test_files: []
|