reform 2.0.3 → 2.0.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 27711bf7172cfebfc6c1d62d3fd0d0c2cf30ca9b
4
- data.tar.gz: 32a1f9984118720c0f5672fa05234399ce5de3a5
3
+ metadata.gz: 565c9da5e49ef68eac9707011e9574284cac113c
4
+ data.tar.gz: 5feef4e923913adb8099b6e307aa38b0adff6dbf
5
5
  SHA512:
6
- metadata.gz: f5919186056ee49ad7ed00f00257e2c6e3dcaa18f7f0e4df7c2218b42f7365fd958dcd541b32987e6423cfc275d2a62fcd983dab98236c81643154e3f27c5bd5
7
- data.tar.gz: a874aa0a645f17c46ba95aa0f379af4a00f9857bba184a88a5f82c57b3a2343ff6c07c69137ed75553452cf0038b726b858dd9ff72513ba109722ee4f4e07d69
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
@@ -4,4 +4,5 @@ gemspec
4
4
 
5
5
  #gem 'representable', path: "../representable"
6
6
  # gem "disposable", path: "../disposable"
7
- # gem "disposable", github: "apotonick/disposable"
7
+ # gem "disposable", github: "apotonick/disposable"o
8
+ # gem "uber", path: "../uber"
data/README.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Reform
2
2
 
3
+ [![Build
4
+ Status](https://travis-ci.org/apotonick/reform.svg)](https://travis-ci.org/apotonick/reform)
5
+ [![Gem Version](https://badge.fury.io/rb/reform.svg)](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.
Binary file
@@ -37,7 +37,7 @@ module Reform
37
37
  # FIXME: test me.
38
38
  def self.properties(*args)
39
39
  options = args.extract_options!
40
- args.each { |name| property(name, options) }
40
+ args.each { |name| property(name, options.dup) }
41
41
  end
42
42
 
43
43
  require 'reform/contract/validate'
@@ -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
@@ -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
- deserializer.apply do |dfn|
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
@@ -1,3 +1,3 @@
1
1
  module Reform
2
- VERSION = "2.0.3"
2
+ VERSION = "2.0.4"
3
3
  end
@@ -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.9"
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"
@@ -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
 
@@ -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\"]}"
@@ -1,313 +1,313 @@
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
-
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
- class PopulateWithActiveRecordTest < MiniTest::Spec
120
- class DiscForm < Reform::Form
119
+ # class PopulateWithActiveRecordTest < MiniTest::Spec
120
+ # class DiscForm < Reform::Form
121
121
 
122
- property :title
122
+ # property :title
123
123
 
124
- collection :tunes, :populate_if_empty => Tune do
125
- property :title
126
- end
127
- end
124
+ # collection :tunes, :populate_if_empty => Tune do
125
+ # property :title
126
+ # end
127
+ # end
128
128
 
129
- let (:disc) { Disc.new(:tunes => []) }
130
- it do
131
- form = DiscForm.new(disc)
129
+ # let (:disc) { Disc.new(:tunes => []) }
130
+ # it do
131
+ # form = DiscForm.new(disc)
132
132
 
133
- form.validate("tunes" => [{"title" => "Straight From The Jacket"}])
133
+ # form.validate("tunes" => [{"title" => "Straight From The Jacket"}])
134
134
 
135
- # form populated.
136
- form.tunes.size.must_equal 1
137
- form.tunes[0].model.must_be_kind_of Tune
135
+ # # form populated.
136
+ # form.tunes.size.must_equal 1
137
+ # form.tunes[0].model.must_be_kind_of Tune
138
138
 
139
- # model NOT populated.
140
- disc.tunes.must_equal []
139
+ # # model NOT populated.
140
+ # disc.tunes.must_equal []
141
141
 
142
142
 
143
- form.sync
143
+ # form.sync
144
144
 
145
- # form populated.
146
- form.tunes.size.must_equal 1
147
- form.tunes[0].model.must_be_kind_of Tune
145
+ # # form populated.
146
+ # form.tunes.size.must_equal 1
147
+ # form.tunes[0].model.must_be_kind_of Tune
148
148
 
149
- # model also populated.
150
- tune = disc.tunes[0]
151
- disc.tunes.must_equal [tune]
152
- tune.title.must_equal "Straight From The Jacket"
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
- # 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
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
- describe "modifying 1., adding 2." do
168
- let (:tune) { Tune.new(:title => "Part 2") }
169
- let (:disc) { Disc.create.tap { |a| a.tunes << tune } }
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
- it do
172
- form = DiscForm.new(disc)
171
+ # it do
172
+ # form = DiscForm.new(disc)
173
173
 
174
- id = disc.tunes[0].id
175
- disc.tunes[0].persisted?.must_equal true
176
- assert id.to_s.size > 0
174
+ # id = disc.tunes[0].id
175
+ # disc.tunes[0].persisted?.must_equal true
176
+ # assert id.to_s.size > 0
177
177
 
178
- form.validate("tunes" => [{"title" => "Part Two"}, {"title" => "Check For A Pulse"}])
178
+ # form.validate("tunes" => [{"title" => "Part Two"}, {"title" => "Check For A Pulse"}])
179
179
 
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
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
- # model NOT populated.
186
- disc.tunes.must_equal [tune]
185
+ # # model NOT populated.
186
+ # disc.tunes.must_equal [tune]
187
187
 
188
188
 
189
- form.sync
189
+ # form.sync
190
190
 
191
- # form populated.
192
- form.tunes.size.must_equal 2
191
+ # # form populated.
192
+ # form.tunes.size.must_equal 2
193
193
 
194
- # model also populated.
195
- disc.tunes.size.must_equal 2
194
+ # # model also populated.
195
+ # disc.tunes.size.must_equal 2
196
196
 
197
- # corrected title
198
- disc.tunes[0].title.must_equal "Part Two"
199
- # ..but same tune.
200
- disc.tunes[0].id.must_equal id
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
- # 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
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
- 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
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
- property :title
212
+ # property :title
213
213
 
214
- collection :tunes, :populate_if_empty => Tune do
215
- property :title
216
- end
217
- end
214
+ # collection :tunes, :populate_if_empty => Tune do
215
+ # property :title
216
+ # end
217
+ # end
218
218
 
219
- let (:disc) { Disc.create(:title => 'Greatest Hits') }
220
- let (:form) { ActiveModelDiscForm.new(disc) }
219
+ # let (:disc) { Disc.create(:title => 'Greatest Hits') }
220
+ # let (:form) { ActiveModelDiscForm.new(disc) }
221
221
 
222
- it do
223
- form.validate('tunes_attributes' => {'0' => {'title' => 'Tango'}})
222
+ # it do
223
+ # form.validate('tunes_attributes' => {'0' => {'title' => 'Tango'}})
224
224
 
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'
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
- # model NOT populated.
231
- disc.tunes.must_equal []
230
+ # # model NOT populated.
231
+ # disc.tunes.must_equal []
232
232
 
233
- form.save
233
+ # form.save
234
234
 
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
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
- # form populated.
241
- form.tunes.size.must_equal 1
240
+ # # form populated.
241
+ # form.tunes.size.must_equal 1
242
242
 
243
- # model also populated.
244
- disc.tunes.size.must_equal 1
245
- disc.tunes[0].title.must_equal 'Tango'
243
+ # # model also populated.
244
+ # disc.tunes.size.must_equal 1
245
+ # disc.tunes[0].title.must_equal 'Tango'
246
246
 
247
- form = ActiveModelDiscForm.new(disc)
248
- form.validate('tunes_attributes' => {'0' => {'id' => first_tune.id, 'title' => 'Tango nuevo'}, '1' => {'title' => 'Waltz'}})
247
+ # form = ActiveModelDiscForm.new(disc)
248
+ # form.validate('tunes_attributes' => {'0' => {'id' => first_tune.id, 'title' => 'Tango nuevo'}, '1' => {'title' => 'Waltz'}})
249
249
 
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'
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
- # model NOT populated.
258
- disc.tunes.size.must_equal 1
259
- disc.tunes[0].title.must_equal 'Tango'
257
+ # # model NOT populated.
258
+ # disc.tunes.size.must_equal 1
259
+ # disc.tunes[0].title.must_equal 'Tango'
260
260
 
261
- form.save
261
+ # form.save
262
262
 
263
- # form populated.
264
- form.tunes.size.must_equal 2
263
+ # # form populated.
264
+ # form.tunes.size.must_equal 2
265
265
 
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
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
- # it do
278
- # a=Disc.new
279
- # a.tunes << Tune.new(title: "Old What's His Name") # Tune does not get persisted.
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
- # a.tunes[1] = Tune.new(title: "Permanent Rust")
281
+ # # a.tunes[1] = Tune.new(title: "Permanent Rust")
282
282
 
283
- # puts "@@@"
284
- # puts a.tunes.inspect
283
+ # # puts "@@@"
284
+ # # puts a.tunes.inspect
285
285
 
286
- # puts "---"
287
- # a.save
288
- # puts a.tunes.inspect
286
+ # # puts "---"
287
+ # # a.save
288
+ # # puts a.tunes.inspect
289
289
 
290
- # b = a.tunes.first
290
+ # # b = a.tunes.first
291
291
 
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?}"
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
- # 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
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
- # b.reload
310
- # puts "#{b.inspect}, #{b.persisted?}"
311
- # end
312
- end
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.3
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-07-22 00:00:00.000000000 Z
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.9
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.9
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: