reform 2.0.3 → 2.0.4
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/Gemfile +2 -1
- data/README.md +4 -0
- data/database.sqlite3 +0 -0
- data/lib/reform/contract.rb +1 -1
- data/lib/reform/form/active_record.rb +4 -0
- data/lib/reform/form/validate.rb +5 -7
- data/lib/reform/version.rb +1 -1
- data/reform.gemspec +2 -1
- data/test/active_record_test.rb +9 -0
- data/test/form_test.rb +1 -1
- data/test/mongoid_test.rb +261 -261
- metadata +19 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 565c9da5e49ef68eac9707011e9574284cac113c
|
4
|
+
data.tar.gz: 5feef4e923913adb8099b6e307aa38b0adff6dbf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c1e962dda69e280292e94394aea4876e3ec2714cf1dc07de305a0c316248ecc065ab23785014838780258c6ac0b91d68d99c5c985494d601ac157636067e97e4
|
7
|
+
data.tar.gz: dbc31dd351bb1ac8cf223e513676d061ed85237a5eecba759319d753a482e5a20246a3859d6e23b8a6ede2893628587c833c8c1b70242fa2dc2a22e3c78252c9
|
data/CHANGES.md
CHANGED
@@ -1,3 +1,7 @@
|
|
1
|
+
## 2.0.4
|
2
|
+
|
3
|
+
* `#sync` and `#save` with block now provide `HashWithIndifferentAccess` in Rails.
|
4
|
+
|
1
5
|
## 2.0.3
|
2
6
|
|
3
7
|
* `Form#valid?` is private now. Sorry for the inconvenience, but this has never been documented as public. Reason is that the only entry point for validation is `#validate` to give the form as less public API as possible and minimize misunderstandings.
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -1,5 +1,9 @@
|
|
1
1
|
# Reform
|
2
2
|
|
3
|
+
[](https://travis-ci.org/apotonick/reform)
|
5
|
+
[](http://badge.fury.io/rb/reform)
|
6
|
+
|
3
7
|
_Form objects decoupled from your models._
|
4
8
|
|
5
9
|
Reform gives you a form object with validations and nested setup of models. It is completely framework-agnostic and doesn't care about your database.
|
data/database.sqlite3
CHANGED
Binary file
|
data/lib/reform/contract.rb
CHANGED
@@ -20,6 +20,10 @@ module Reform::Form::ActiveRecord
|
|
20
20
|
end
|
21
21
|
end
|
22
22
|
|
23
|
+
def to_nested_hash(*)
|
24
|
+
super.with_indifferent_access
|
25
|
+
end
|
26
|
+
|
23
27
|
class UniquenessValidator < ::ActiveRecord::Validations::UniquenessValidator
|
24
28
|
include Reform::Form::ORM::UniquenessValidator
|
25
29
|
end
|
data/lib/reform/form/validate.rb
CHANGED
@@ -62,19 +62,17 @@ private
|
|
62
62
|
include: [Representable::Hash::AllowSymbols, Representable::Hash],
|
63
63
|
superclass: Representable::Decorator,
|
64
64
|
representer_from: lambda { |inline| inline.representer_class },
|
65
|
-
options_from: :deserializer
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
next unless dfn[:twin]
|
70
|
-
# Representer#each and #apply have to be unified.
|
65
|
+
options_from: :deserializer,
|
66
|
+
exclude_options: [:default], # Reform must not copy Disposable/Reform-only options that might confuse representable.
|
67
|
+
) do |dfn|
|
68
|
+
# next unless dfn[:twin]
|
71
69
|
dfn.merge!(
|
72
70
|
deserialize: lambda { |decorator, params, options|
|
73
71
|
params = decorator.represented.deserialize!(params) # let them set up params. # FIXME: we could also get a new deserializer here.
|
74
72
|
|
75
73
|
decorator.from_hash(params) # options.binding.deserialize_method.inspect
|
76
74
|
}
|
77
|
-
)
|
75
|
+
) if dfn[:twin]
|
78
76
|
end
|
79
77
|
|
80
78
|
deserializer
|
data/lib/reform/version.rb
CHANGED
data/reform.gemspec
CHANGED
@@ -17,7 +17,7 @@ Gem::Specification.new do |spec|
|
|
17
17
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
18
18
|
spec.require_paths = ["lib"]
|
19
19
|
|
20
|
-
spec.add_dependency "disposable", "~> 0.1.
|
20
|
+
spec.add_dependency "disposable", "~> 0.1.11"
|
21
21
|
spec.add_dependency "uber", "~> 0.0.11"
|
22
22
|
|
23
23
|
spec.add_development_dependency "bundler"
|
@@ -28,6 +28,7 @@ Gem::Specification.new do |spec|
|
|
28
28
|
spec.add_development_dependency "virtus"
|
29
29
|
spec.add_development_dependency "rails"
|
30
30
|
spec.add_development_dependency "mongoid"
|
31
|
+
spec.add_development_dependency "multi_json"
|
31
32
|
|
32
33
|
spec.add_development_dependency "lotus-validations"
|
33
34
|
spec.add_development_dependency "actionpack"
|
data/test/active_record_test.rb
CHANGED
@@ -96,6 +96,15 @@ class ActiveRecordTest < MiniTest::Spec
|
|
96
96
|
form.save {}
|
97
97
|
Artist.where(:name => "Bad Religion").size.must_equal 0
|
98
98
|
end
|
99
|
+
|
100
|
+
it "can access block params using string or hash key" do
|
101
|
+
Artist.delete_all
|
102
|
+
form.validate("artist" => {"name" => "Paul Gilbert"}, "title" => "The Gargoyle", "created_at" => "November 6, 1966")
|
103
|
+
form.save do |params|
|
104
|
+
params[:title].must_equal 'The Gargoyle'
|
105
|
+
params['title'].must_equal 'The Gargoyle'
|
106
|
+
end
|
107
|
+
end
|
99
108
|
end
|
100
109
|
end
|
101
110
|
|
data/test/form_test.rb
CHANGED
@@ -25,7 +25,7 @@ class FormTest < MiniTest::Spec
|
|
25
25
|
property :title, validates: {presence: true}
|
26
26
|
properties :genre, :band, validates: {presence: true}
|
27
27
|
end
|
28
|
-
it do
|
28
|
+
it "xxx" do
|
29
29
|
form = SongForm.new(OpenStruct.new)
|
30
30
|
form.validate({})
|
31
31
|
form.errors.to_s.must_equal "{:title=>[\"can't be blank\"], :genre=>[\"can't be blank\"], :band=>[\"can't be blank\"]}"
|
data/test/mongoid_test.rb
CHANGED
@@ -1,313 +1,313 @@
|
|
1
|
-
require 'test_helper'
|
2
|
-
def mongoid_present?
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
rescue
|
9
|
-
|
10
|
-
end
|
11
|
-
|
12
|
-
if mongoid_present?
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
1
|
+
# require 'test_helper'
|
2
|
+
# def mongoid_present?
|
3
|
+
# require 'mongoid'
|
4
|
+
# Mongoid.configure do |config|
|
5
|
+
# config.connect_to("reform-mongoid-test")
|
6
|
+
# end
|
7
|
+
# true
|
8
|
+
# rescue
|
9
|
+
# false
|
10
|
+
# end
|
11
|
+
|
12
|
+
# if mongoid_present?
|
13
|
+
# require 'reform/mongoid'
|
14
|
+
|
15
|
+
# class Disc
|
16
|
+
# include Mongoid::Document
|
17
|
+
# field :title, type: String
|
18
|
+
# has_many :tunes
|
19
|
+
# has_and_belongs_to_many :musicians
|
20
|
+
# end
|
21
|
+
|
22
|
+
# class Musician
|
23
|
+
# include Mongoid::Document
|
24
|
+
# field :name, type: String
|
25
|
+
# end
|
26
|
+
|
27
|
+
# class Tune
|
28
|
+
# include Mongoid::Document
|
29
|
+
# include Mongoid::Timestamps
|
30
|
+
# field :title, type: String
|
31
|
+
# belongs_to :disc
|
32
|
+
# belongs_to :musician
|
33
|
+
# end
|
34
|
+
|
35
|
+
# class MongoidTest < MiniTest::Spec
|
36
|
+
# class TuneForm < Reform::Form
|
37
|
+
# include Reform::Form::Mongoid
|
38
|
+
# model :tune
|
39
|
+
|
40
|
+
# property :title
|
41
|
+
# property :created_at
|
42
|
+
|
43
|
+
# validates_uniqueness_of :title, scope: [:disc_id, :musician_id]
|
44
|
+
# validates :created_at, :presence => true # have another property to test if we mix up.
|
45
|
+
|
46
|
+
# property :musician do
|
47
|
+
# property :name
|
48
|
+
# validates_uniqueness_of :name # this currently also tests if Form::AR is included as a feature.
|
49
|
+
# end
|
50
|
+
# end
|
51
|
+
|
52
|
+
# let(:disc) { Disc.create(:title => "Damnation") }
|
53
|
+
# let(:musician) { Musician.create(:name => "Opeth") }
|
54
|
+
# let(:form) { TuneForm.new(Tune.new(:musician => Musician.new)) }
|
55
|
+
|
56
|
+
# it { form.class.i18n_scope.must_equal :mongoid }
|
57
|
+
|
58
|
+
# it "allows accessing the database" do
|
59
|
+
# end
|
60
|
+
|
61
|
+
# # uniqueness
|
62
|
+
# it "has no errors on title when title is unique for the same musician and disc" do
|
63
|
+
# form.validate("title" => "The Gargoyle", "musician_id" => musician.id, "disc" => disc.id, "created_at" => "November 6, 1966")
|
64
|
+
# assert_empty form.errors[:title]
|
65
|
+
# end
|
66
|
+
|
67
|
+
# it "has errors on title when title is taken for the same musician and disc" do
|
68
|
+
# skip "replace ActiveModel::Validations with our own, working and reusable gem."
|
69
|
+
# Tune.create(title: "Windowpane", musician_id: musician.id, disc_id: disc.id)
|
70
|
+
# form.validate("title" => "Windowpane", "musician_id" => musician.id, "disc" => disc)
|
71
|
+
# refute_empty form.errors[:title]
|
72
|
+
# end
|
73
|
+
|
74
|
+
# # nested object taken.
|
75
|
+
# it "is valid when musician name is unique" do
|
76
|
+
# form.validate("musician" => {"name" => "Paul Gilbert"}, "title" => "The Gargoyle", "created_at" => "November 6, 1966").must_equal true
|
77
|
+
# end
|
78
|
+
|
79
|
+
# it "is invalid and shows error when taken" do
|
80
|
+
# Tune.delete_all
|
81
|
+
# Musician.create(:name => "Racer X")
|
82
|
+
|
83
|
+
# form.validate("musician" => {"name" => "Racer X"}, "title" => "Ghost Inside My Skin").must_equal false
|
84
|
+
# form.errors.messages.must_equal({:"musician.name"=>["is already taken"], :created_at => ["can't be blank"]})
|
85
|
+
# end
|
86
|
+
|
87
|
+
# it "works with Composition" do
|
88
|
+
# form = Class.new(Reform::Form) do
|
89
|
+
# include Reform::Form::Mongoid
|
90
|
+
# include Reform::Form::Composition
|
91
|
+
|
92
|
+
# property :name, :on => :musician
|
93
|
+
# validates_uniqueness_of :name
|
94
|
+
# end.new(:musician => Musician.new)
|
95
|
+
|
96
|
+
# Musician.create(:name => "Bad Religion")
|
97
|
+
# form.validate("name" => "Bad Religion").must_equal false
|
98
|
+
# end
|
99
|
+
|
100
|
+
# describe "#save" do
|
101
|
+
# # TODO: test 1-n?
|
102
|
+
# it "calls model.save" do
|
103
|
+
# Musician.delete_all
|
104
|
+
# form.validate("musician" => {"name" => "Bad Religion"}, "title" => "Ghost Inside My Skin")
|
105
|
+
# form.save
|
106
|
+
# Musician.where(:name => "Bad Religion").size.must_equal 1
|
107
|
+
# end
|
108
|
+
|
109
|
+
# it "doesn't call model.save when block is given" do
|
110
|
+
# Musician.delete_all
|
111
|
+
# form.validate("name" => "Bad Religion")
|
112
|
+
# form.save {}
|
113
|
+
# Musician.where(:name => "Bad Religion").size.must_equal 0
|
114
|
+
# end
|
115
|
+
# end
|
116
|
+
# end
|
117
|
+
|
118
118
|
|
119
|
-
|
120
|
-
|
119
|
+
# class PopulateWithActiveRecordTest < MiniTest::Spec
|
120
|
+
# class DiscForm < Reform::Form
|
121
121
|
|
122
|
-
|
122
|
+
# property :title
|
123
123
|
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
124
|
+
# collection :tunes, :populate_if_empty => Tune do
|
125
|
+
# property :title
|
126
|
+
# end
|
127
|
+
# end
|
128
128
|
|
129
|
-
|
130
|
-
|
131
|
-
|
129
|
+
# let (:disc) { Disc.new(:tunes => []) }
|
130
|
+
# it do
|
131
|
+
# form = DiscForm.new(disc)
|
132
132
|
|
133
|
-
|
133
|
+
# form.validate("tunes" => [{"title" => "Straight From The Jacket"}])
|
134
134
|
|
135
|
-
|
136
|
-
|
137
|
-
|
135
|
+
# # form populated.
|
136
|
+
# form.tunes.size.must_equal 1
|
137
|
+
# form.tunes[0].model.must_be_kind_of Tune
|
138
138
|
|
139
|
-
|
140
|
-
|
139
|
+
# # model NOT populated.
|
140
|
+
# disc.tunes.must_equal []
|
141
141
|
|
142
142
|
|
143
|
-
|
143
|
+
# form.sync
|
144
144
|
|
145
|
-
|
146
|
-
|
147
|
-
|
145
|
+
# # form populated.
|
146
|
+
# form.tunes.size.must_equal 1
|
147
|
+
# form.tunes[0].model.must_be_kind_of Tune
|
148
148
|
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
149
|
+
# # model also populated.
|
150
|
+
# tune = disc.tunes[0]
|
151
|
+
# disc.tunes.must_equal [tune]
|
152
|
+
# tune.title.must_equal "Straight From The Jacket"
|
153
153
|
|
154
154
|
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
155
|
+
# # if ActiveRecord::VERSION::STRING !~ /^3.0/
|
156
|
+
# # # saving saves association.
|
157
|
+
# # form.save
|
158
|
+
# #
|
159
|
+
# # disc.reload
|
160
|
+
# # tune = disc.tunes[0]
|
161
|
+
# # disc.tunes.must_equal [tune]
|
162
|
+
# # tune.title.must_equal "Straight From The Jacket"
|
163
|
+
# # end
|
164
|
+
# end
|
165
165
|
|
166
166
|
|
167
|
-
|
168
|
-
|
169
|
-
|
167
|
+
# describe "modifying 1., adding 2." do
|
168
|
+
# let (:tune) { Tune.new(:title => "Part 2") }
|
169
|
+
# let (:disc) { Disc.create.tap { |a| a.tunes << tune } }
|
170
170
|
|
171
|
-
|
172
|
-
|
171
|
+
# it do
|
172
|
+
# form = DiscForm.new(disc)
|
173
173
|
|
174
|
-
|
175
|
-
|
176
|
-
|
174
|
+
# id = disc.tunes[0].id
|
175
|
+
# disc.tunes[0].persisted?.must_equal true
|
176
|
+
# assert id.to_s.size > 0
|
177
177
|
|
178
|
-
|
178
|
+
# form.validate("tunes" => [{"title" => "Part Two"}, {"title" => "Check For A Pulse"}])
|
179
179
|
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
180
|
+
# # form populated.
|
181
|
+
# form.tunes.size.must_equal 2
|
182
|
+
# form.tunes[0].model.must_be_kind_of Tune
|
183
|
+
# form.tunes[1].model.must_be_kind_of Tune
|
184
184
|
|
185
|
-
|
186
|
-
|
185
|
+
# # model NOT populated.
|
186
|
+
# disc.tunes.must_equal [tune]
|
187
187
|
|
188
188
|
|
189
|
-
|
189
|
+
# form.sync
|
190
190
|
|
191
|
-
|
192
|
-
|
191
|
+
# # form populated.
|
192
|
+
# form.tunes.size.must_equal 2
|
193
193
|
|
194
|
-
|
195
|
-
|
194
|
+
# # model also populated.
|
195
|
+
# disc.tunes.size.must_equal 2
|
196
196
|
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
197
|
+
# # corrected title
|
198
|
+
# disc.tunes[0].title.must_equal "Part Two"
|
199
|
+
# # ..but same tune.
|
200
|
+
# disc.tunes[0].id.must_equal id
|
201
201
|
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
202
|
+
# # and a new tune.
|
203
|
+
# disc.tunes[1].title.must_equal "Check For A Pulse"
|
204
|
+
# disc.tunes[1].persisted?.must_equal true # TODO: with << strategy, this shouldn't be saved.
|
205
|
+
# end
|
206
206
|
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
207
|
+
# describe 'using nested_models_attributes to modify nested collection' do
|
208
|
+
# class ActiveModelDiscForm < Reform::Form
|
209
|
+
# include Reform::Form::ActiveModel
|
210
|
+
# include Reform::Form::ActiveModel::FormBuilderMethods
|
211
211
|
|
212
|
-
|
212
|
+
# property :title
|
213
213
|
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
214
|
+
# collection :tunes, :populate_if_empty => Tune do
|
215
|
+
# property :title
|
216
|
+
# end
|
217
|
+
# end
|
218
218
|
|
219
|
-
|
220
|
-
|
219
|
+
# let (:disc) { Disc.create(:title => 'Greatest Hits') }
|
220
|
+
# let (:form) { ActiveModelDiscForm.new(disc) }
|
221
221
|
|
222
|
-
|
223
|
-
|
222
|
+
# it do
|
223
|
+
# form.validate('tunes_attributes' => {'0' => {'title' => 'Tango'}})
|
224
224
|
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
225
|
+
# # form populated.
|
226
|
+
# form.tunes.size.must_equal 1
|
227
|
+
# form.tunes[0].model.must_be_kind_of Tune
|
228
|
+
# form.tunes[0].title.must_equal 'Tango'
|
229
229
|
|
230
|
-
|
231
|
-
|
230
|
+
# # model NOT populated.
|
231
|
+
# disc.tunes.must_equal []
|
232
232
|
|
233
|
-
|
233
|
+
# form.save
|
234
234
|
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
235
|
+
# # nested model persisted.
|
236
|
+
# first_tune = disc.tunes[0]
|
237
|
+
# first_tune.persisted?.must_equal true
|
238
|
+
# assert first_tune.id.to_s.size > 0
|
239
239
|
|
240
|
-
|
241
|
-
|
240
|
+
# # form populated.
|
241
|
+
# form.tunes.size.must_equal 1
|
242
242
|
|
243
|
-
|
244
|
-
|
245
|
-
|
243
|
+
# # model also populated.
|
244
|
+
# disc.tunes.size.must_equal 1
|
245
|
+
# disc.tunes[0].title.must_equal 'Tango'
|
246
246
|
|
247
|
-
|
248
|
-
|
247
|
+
# form = ActiveModelDiscForm.new(disc)
|
248
|
+
# form.validate('tunes_attributes' => {'0' => {'id' => first_tune.id, 'title' => 'Tango nuevo'}, '1' => {'title' => 'Waltz'}})
|
249
249
|
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
250
|
+
# # form populated.
|
251
|
+
# form.tunes.size.must_equal 2
|
252
|
+
# form.tunes[0].model.must_be_kind_of Tune
|
253
|
+
# form.tunes[1].model.must_be_kind_of Tune
|
254
|
+
# form.tunes[0].title.must_equal 'Tango nuevo'
|
255
|
+
# form.tunes[1].title.must_equal 'Waltz'
|
256
256
|
|
257
|
-
|
258
|
-
|
259
|
-
|
257
|
+
# # model NOT populated.
|
258
|
+
# disc.tunes.size.must_equal 1
|
259
|
+
# disc.tunes[0].title.must_equal 'Tango'
|
260
260
|
|
261
|
-
|
261
|
+
# form.save
|
262
262
|
|
263
|
-
|
264
|
-
|
263
|
+
# # form populated.
|
264
|
+
# form.tunes.size.must_equal 2
|
265
265
|
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
266
|
+
# # model also populated.
|
267
|
+
# disc.tunes.size.must_equal 2
|
268
|
+
# disc.tunes[0].id.must_equal first_tune.id
|
269
|
+
# disc.tunes[0].persisted?.must_equal true
|
270
|
+
# disc.tunes[1].persisted?.must_equal true
|
271
|
+
# disc.tunes[0].title.must_equal 'Tango nuevo'
|
272
|
+
# disc.tunes[1].title.must_equal 'Waltz'
|
273
|
+
# end
|
274
|
+
# end
|
275
|
+
# end
|
276
276
|
|
277
|
-
|
278
|
-
|
279
|
-
|
277
|
+
# # it do
|
278
|
+
# # a=Disc.new
|
279
|
+
# # a.tunes << Tune.new(title: "Old What's His Name") # Tune does not get persisted.
|
280
280
|
|
281
|
-
|
281
|
+
# # a.tunes[1] = Tune.new(title: "Permanent Rust")
|
282
282
|
|
283
|
-
|
284
|
-
|
283
|
+
# # puts "@@@"
|
284
|
+
# # puts a.tunes.inspect
|
285
285
|
|
286
|
-
|
287
|
-
|
288
|
-
|
286
|
+
# # puts "---"
|
287
|
+
# # a.save
|
288
|
+
# # puts a.tunes.inspect
|
289
289
|
|
290
|
-
|
290
|
+
# # b = a.tunes.first
|
291
291
|
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
292
|
+
# # a.tunes = [Tune.new(title:"Biomag")]
|
293
|
+
# # puts "\\\\"
|
294
|
+
# # a.save
|
295
|
+
# # a.reload
|
296
|
+
# # puts a.tunes.inspect
|
297
|
+
|
298
|
+
# # b.reload
|
299
|
+
# # puts "#{b.inspect}, #{b.persisted?}"
|
300
300
|
|
301
301
|
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
|
302
|
+
# # a.tunes = [a.tunes.first, Tune.new(title: "Count Down")]
|
303
|
+
# # b = a.tunes.first
|
304
|
+
# # puts ":::::"
|
305
|
+
# # a.save
|
306
|
+
# # a.reload
|
307
|
+
# # puts a.tunes.inspect
|
308
308
|
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
end
|
309
|
+
# # b.reload
|
310
|
+
# # puts "#{b.inspect}, #{b.persisted?}"
|
311
|
+
# # end
|
312
|
+
# end
|
313
|
+
# 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.
|
4
|
+
version: 2.0.4
|
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-
|
12
|
+
date: 2015-08-27 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: disposable
|
@@ -17,14 +17,14 @@ dependencies:
|
|
17
17
|
requirements:
|
18
18
|
- - "~>"
|
19
19
|
- !ruby/object:Gem::Version
|
20
|
-
version: 0.1.
|
20
|
+
version: 0.1.11
|
21
21
|
type: :runtime
|
22
22
|
prerelease: false
|
23
23
|
version_requirements: !ruby/object:Gem::Requirement
|
24
24
|
requirements:
|
25
25
|
- - "~>"
|
26
26
|
- !ruby/object:Gem::Version
|
27
|
-
version: 0.1.
|
27
|
+
version: 0.1.11
|
28
28
|
- !ruby/object:Gem::Dependency
|
29
29
|
name: uber
|
30
30
|
requirement: !ruby/object:Gem::Requirement
|
@@ -151,6 +151,20 @@ dependencies:
|
|
151
151
|
- - ">="
|
152
152
|
- !ruby/object:Gem::Version
|
153
153
|
version: '0'
|
154
|
+
- !ruby/object:Gem::Dependency
|
155
|
+
name: multi_json
|
156
|
+
requirement: !ruby/object:Gem::Requirement
|
157
|
+
requirements:
|
158
|
+
- - ">="
|
159
|
+
- !ruby/object:Gem::Version
|
160
|
+
version: '0'
|
161
|
+
type: :development
|
162
|
+
prerelease: false
|
163
|
+
version_requirements: !ruby/object:Gem::Requirement
|
164
|
+
requirements:
|
165
|
+
- - ">="
|
166
|
+
- !ruby/object:Gem::Version
|
167
|
+
version: '0'
|
154
168
|
- !ruby/object:Gem::Dependency
|
155
169
|
name: lotus-validations
|
156
170
|
requirement: !ruby/object:Gem::Requirement
|
@@ -384,3 +398,4 @@ test_files:
|
|
384
398
|
- test/validate_test.rb
|
385
399
|
- test/virtual_test.rb
|
386
400
|
- test/writeable_test.rb
|
401
|
+
has_rdoc:
|