reform 2.0.0.rc2 → 2.0.0.rc3
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/CHANGES.md +4 -0
- data/database.sqlite3 +0 -0
- data/lib/reform/form/active_model/validations.rb +7 -2
- data/lib/reform/version.rb +1 -1
- data/test/lotus/Gemfile +5 -0
- data/test/lotus/lotus_test.rb +27 -0
- metadata +6 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1656561190a1c9784f1e2463e6c4e2c558bb78d0
|
4
|
+
data.tar.gz: 236cc4811f68a6e6e6e7a9e0a31d11a4afbe955d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2aa18198338829e843a002d940dfb60d0f4d318662637d064f01a668f30fd59bf20fa3fe11dd25b7a5534e93b986aabc54d19cf2f01e3e42f02c81273fe7601a
|
7
|
+
data.tar.gz: 4d9cea3a1c22769400c48164b2a907e0b8f713a82b2cb9e11fb0fb97bbc963f3a5445da828b4b899b2dd4b420416fb7b7d94f1f6c400378e47210c64028d99f5
|
data/CHANGES.md
CHANGED
@@ -17,6 +17,10 @@ you don't need to know about forms anymore, the twin handles that using #insert.
|
|
17
17
|
* Forms do not `include ActiveModel::Validations` anymore. This has polluted the entire gem and is not encapsulated in `Validator`. Consider using Lotus Validations instead.
|
18
18
|
* Validation inheritance with `ActiveModel::Validations` is broken with Rails 3.2 and 4.0. Update Rails or use the `Lotus` validations.
|
19
19
|
|
20
|
+
## 2.0.0.rc3
|
21
|
+
|
22
|
+
* Fix an annoying bug coming from Rails autoloader with validations and `model_name`.
|
23
|
+
|
20
24
|
## 1.2.6
|
21
25
|
|
22
26
|
* Added `:prepopulate` to fill out form properties for presentation. Note that you need to call `Form#prepopulate!` to trigger the prepopulation.
|
data/database.sqlite3
CHANGED
Binary file
|
@@ -31,6 +31,7 @@ module Reform::Form::ActiveModel
|
|
31
31
|
# on instance, it exposes #valid?.
|
32
32
|
class Validator
|
33
33
|
include ActiveModel::Validations
|
34
|
+
# extend ActiveModel::Naming
|
34
35
|
|
35
36
|
def initialize(form)
|
36
37
|
@form = form
|
@@ -40,9 +41,13 @@ module Reform::Form::ActiveModel
|
|
40
41
|
@form.send(method_name, *args, &block)
|
41
42
|
end
|
42
43
|
|
43
|
-
def self.
|
44
|
-
|
44
|
+
# def self.model_name # FIXME: this is only needed for i18n, it seems.
|
45
|
+
# "Reform::Form"
|
46
|
+
# end
|
47
|
+
def self.model_name
|
48
|
+
ActiveModel::Name.new(Reform::Form)
|
45
49
|
end
|
50
|
+
# we can also do self.name and return "reform/form" but then run into "wrong constant name reform/form" from the autoloader. wtf?
|
46
51
|
|
47
52
|
def self.clone
|
48
53
|
Class.new(self)
|
data/lib/reform/version.rb
CHANGED
data/test/lotus/Gemfile
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
require "reform"
|
2
|
+
require "reform/form/lotus"
|
3
|
+
require "minitest/autorun"
|
4
|
+
|
5
|
+
Reform::Contract.class_eval do
|
6
|
+
include Reform::Contract::Validate
|
7
|
+
include Reform::Form::Lotus
|
8
|
+
end
|
9
|
+
|
10
|
+
class LotusTest < Minitest::Spec
|
11
|
+
Album = Struct.new(:title, :songs, :artist)
|
12
|
+
|
13
|
+
class AlbumForm < Reform::Form
|
14
|
+
|
15
|
+
|
16
|
+
property :title
|
17
|
+
validates :title, presence: true
|
18
|
+
end
|
19
|
+
|
20
|
+
it do
|
21
|
+
form = AlbumForm.new(Album.new("Show Completo"))
|
22
|
+
|
23
|
+
form.validate(title: "").must_equal false
|
24
|
+
|
25
|
+
form.errors.to_s.must_equal ""
|
26
|
+
end
|
27
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: reform
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.0.
|
4
|
+
version: 2.0.0.rc3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nick Sutterer
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2015-07-
|
12
|
+
date: 2015-07-08 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: disposable
|
@@ -273,6 +273,8 @@ files:
|
|
273
273
|
- test/form_test.rb
|
274
274
|
- test/from_test.rb
|
275
275
|
- test/inherit_test.rb
|
276
|
+
- test/lotus/Gemfile
|
277
|
+
- test/lotus/lotus_test.rb
|
276
278
|
- test/lotus_test.rb
|
277
279
|
- test/model_reflections_test.rb
|
278
280
|
- test/model_validations_test.rb
|
@@ -360,6 +362,8 @@ test_files:
|
|
360
362
|
- test/form_test.rb
|
361
363
|
- test/from_test.rb
|
362
364
|
- test/inherit_test.rb
|
365
|
+
- test/lotus/Gemfile
|
366
|
+
- test/lotus/lotus_test.rb
|
363
367
|
- test/lotus_test.rb
|
364
368
|
- test/model_reflections_test.rb
|
365
369
|
- test/model_validations_test.rb
|