form_obj 1.0.1 → 1.0.2
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/CHANGELOG.md +12 -0
- data/Gemfile.lock +1 -1
- data/README.md +1 -1
- data/lib/form_obj/form/array.rb +1 -1
- data/lib/form_obj/form.rb +1 -9
- data/lib/form_obj/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 52a8db57a0aa766bd26bfbc373628fc03bfb3ad1ec6af8632d2dda7794023f7f
|
4
|
+
data.tar.gz: 936150e73db9a6a1112697fedc9dffe8349e3436f38b162c3af7264109eadac4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 79007cdba40e1c96af3bf4e35eb58b674d34d1b6e1097fbb83a2d3cdad2b71c0c63f490731943ceb2049cbe762ddbc46ea5f3724bde706dbfcffda98a02e82f1
|
7
|
+
data.tar.gz: b8dc843ea727770b48519ac9734f83d370b8032270b3e1ee223d289816ddc4fca97fe3d4d8e79da41503f92858296f06f54eadb26878c480435979f8f0ef236e
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,17 @@
|
|
1
1
|
# Change Log
|
2
2
|
|
3
|
+
## [v1.0.2](https://github.com/akoltun/form_obj/tree/v1.0.2) (2018-08-14)
|
4
|
+
|
5
|
+
[Full Changelog](https://github.com/akoltun/form_obj/compare/v1.0.1...v1.0.2)
|
6
|
+
|
7
|
+
**Closed issues:**
|
8
|
+
|
9
|
+
- Correct persisted? behaviour in accord with ActiveRecord [\#65](https://github.com/akoltun/form_obj/issues/65)
|
10
|
+
|
11
|
+
**Merged pull requests:**
|
12
|
+
|
13
|
+
- Fix persisted behaviour [\#66](https://github.com/akoltun/form_obj/pull/66) ([akoltun](https://github.com/akoltun))
|
14
|
+
|
3
15
|
## [v1.0.1](https://github.com/akoltun/form_obj/tree/v1.0.1) (2018-07-19)
|
4
16
|
[Full Changelog](https://github.com/akoltun/form_obj/compare/v1.0.0...v1.0.1)
|
5
17
|
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -750,7 +750,7 @@ team.errors.messages # => {:name=>["is too short (minimum is 10
|
|
750
750
|
#### 2.2. `FormObj::Form` Persistence
|
751
751
|
|
752
752
|
In order to make `FormObj::Form` compatible with form builder it has to respond to `:persisted?` message.
|
753
|
-
|
753
|
+
Initial form is not persisted.
|
754
754
|
It can be marked as persisted by assigning `persisted = true` which marks as persisted only form itself or
|
755
755
|
by calling `mark_as_persisted` method which marks as persisted the form itself and all nested forms and arrays.
|
756
756
|
|
data/lib/form_obj/form/array.rb
CHANGED
data/lib/form_obj/form.rb
CHANGED
@@ -42,9 +42,7 @@ module FormObj
|
|
42
42
|
end
|
43
43
|
|
44
44
|
def persisted?
|
45
|
-
@persisted
|
46
|
-
persisted && (!attr.subform? || read_attribute(attr).persisted?)
|
47
|
-
}
|
45
|
+
@persisted
|
48
46
|
end
|
49
47
|
|
50
48
|
def mark_as_persisted
|
@@ -60,7 +58,6 @@ module FormObj
|
|
60
58
|
self.class._attributes.each { |attr|
|
61
59
|
read_attribute(attr).mark_for_destruction if attr.subform?
|
62
60
|
}
|
63
|
-
self.persisted = false
|
64
61
|
self
|
65
62
|
end
|
66
63
|
|
@@ -74,11 +71,6 @@ module FormObj
|
|
74
71
|
|
75
72
|
private
|
76
73
|
|
77
|
-
def _set_attribute_value(attribute, value)
|
78
|
-
@persisted = false unless _get_attribute_value(attribute) === value
|
79
|
-
super
|
80
|
-
end
|
81
|
-
|
82
74
|
def inner_inspect
|
83
75
|
"#{super}#{marked_for_destruction? ? ' marked_for_destruction' : ''}"
|
84
76
|
end
|
data/lib/form_obj/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: form_obj
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alexander Koltun
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-08-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: typed_array
|