massive_record 0.2.0.beta → 0.2.0.beta2
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.
- data/CHANGELOG.md +8 -1
- data/Gemfile.lock +1 -1
- data/lib/massive_record/orm/attribute_methods.rb +1 -1
- data/lib/massive_record/orm/base.rb +3 -1
- data/lib/massive_record/orm/errors.rb +1 -1
- data/lib/massive_record/orm/relations/interface.rb +4 -0
- data/lib/massive_record/version.rb +1 -1
- data/spec/orm/cases/attribute_methods_spec.rb +1 -1
- data/spec/orm/cases/base_spec.rb +4 -0
- data/spec/orm/relations/interface_spec.rb +17 -0
- data/spec/wrapper/cases/table_spec.rb +0 -10
- metadata +2 -2
data/CHANGELOG.md
CHANGED
@@ -1,4 +1,8 @@
|
|
1
|
-
# v0.2.0 (git develop)
|
1
|
+
# v0.2.0.beta2 (git develop)
|
2
|
+
|
3
|
+
- We are now raising error if MassiveRecordClass.new(attributes) receives unknown attributes.
|
4
|
+
- Added support for Record.new(:references_many => [record, record]) and a_record.references_many = [record, record]
|
5
|
+
|
2
6
|
|
3
7
|
|
4
8
|
# v0.2.0.beta (git master)
|
@@ -26,11 +30,13 @@
|
|
26
30
|
- Simple implementation of references_one relation. This is where you have a foreign key you will look up in a different table.
|
27
31
|
|
28
32
|
|
33
|
+
|
29
34
|
# v0.1.2
|
30
35
|
- Fixed, or at least made better, the is_yaml? method in Wrapper::Cell.This functionality of serialize/de-serialize
|
31
36
|
should be moved up into the ORM asap, but for now a hot fix has been applied.
|
32
37
|
|
33
38
|
|
39
|
+
|
34
40
|
# v0.1.1
|
35
41
|
|
36
42
|
- A ORM record now now if it is read only or not.
|
@@ -42,6 +48,7 @@
|
|
42
48
|
- Bugfix: Database cleaner no longer tries to remove tables with same name twice.
|
43
49
|
|
44
50
|
|
51
|
+
|
45
52
|
# v0.1.0
|
46
53
|
|
47
54
|
- Communication with Hbase via Thrift.
|
data/Gemfile.lock
CHANGED
@@ -112,9 +112,11 @@ module MassiveRecord
|
|
112
112
|
|
113
113
|
attributes = {} if attributes.nil?
|
114
114
|
|
115
|
-
self.attributes_raw = attributes_from_field_definition
|
115
|
+
self.attributes_raw = attributes_from_field_definition
|
116
116
|
self.attributes = attributes
|
117
117
|
|
118
|
+
clear_dirty_states!
|
119
|
+
|
118
120
|
_run_initialize_callbacks
|
119
121
|
end
|
120
122
|
|
@@ -134,6 +134,10 @@ module MassiveRecord
|
|
134
134
|
relation_proxy(metadata.name)
|
135
135
|
end
|
136
136
|
|
137
|
+
redefine_method(metadata.name+'=') do |records|
|
138
|
+
relation_proxy(metadata.name).replace(records)
|
139
|
+
end
|
140
|
+
|
137
141
|
if metadata.persisting_foreign_key?
|
138
142
|
add_field_to_column_family(metadata.store_in, metadata.foreign_key, :type => :array, :default => [])
|
139
143
|
end
|
@@ -45,7 +45,7 @@ describe "attribute methods" do
|
|
45
45
|
end
|
46
46
|
|
47
47
|
it "should raise an error if we encounter an unkown attribute" do
|
48
|
-
lambda { @model.attributes = {:unkown => "foo"} }.should raise_error MassiveRecord::ORM::
|
48
|
+
lambda { @model.attributes = {:unkown => "foo"} }.should raise_error MassiveRecord::ORM::UnknownAttributeError
|
49
49
|
end
|
50
50
|
end
|
51
51
|
end
|
data/spec/orm/cases/base_spec.rb
CHANGED
@@ -81,6 +81,10 @@ describe MassiveRecord::ORM::Base do
|
|
81
81
|
model.foo.should == 'bar'
|
82
82
|
end
|
83
83
|
|
84
|
+
it "should raise error if attribute is unknown" do
|
85
|
+
lambda { TestClass.new :unknown => 'attribute' }.should raise_error MassiveRecord::ORM::UnknownAttributeError
|
86
|
+
end
|
87
|
+
|
84
88
|
it "should initialize an object via init_with()" do
|
85
89
|
model = TestClass.allocate
|
86
90
|
model.init_with 'attributes' => {:foo => 'bar'}
|
@@ -89,6 +89,12 @@ describe MassiveRecord::ORM::Relations::Interface do
|
|
89
89
|
2.times { subject.boss }
|
90
90
|
end
|
91
91
|
end
|
92
|
+
|
93
|
+
|
94
|
+
it "should be assignable in initializer" do
|
95
|
+
person = Person.new :boss => boss
|
96
|
+
person.boss.should == boss
|
97
|
+
end
|
92
98
|
end
|
93
99
|
end
|
94
100
|
|
@@ -196,12 +202,23 @@ describe MassiveRecord::ORM::Relations::Interface do
|
|
196
202
|
let(:proxy) { subject.send(:relation_proxy, "test_classes") }
|
197
203
|
|
198
204
|
it { should respond_to :test_classes }
|
205
|
+
it { should respond_to :test_classes= }
|
199
206
|
it { should respond_to :test_class_ids }
|
200
207
|
it { should respond_to :test_class_ids= }
|
201
208
|
|
202
209
|
it "should have an array as foreign_key attribute" do
|
203
210
|
subject.test_class_ids.should be_instance_of Array
|
204
211
|
end
|
212
|
+
|
213
|
+
it "should be assignable" do
|
214
|
+
subject.test_classes = [test_class]
|
215
|
+
subject.test_classes.should == [test_class]
|
216
|
+
end
|
217
|
+
|
218
|
+
it "should be assignable in initializer" do
|
219
|
+
person = Person.new :test_classes => [test_class]
|
220
|
+
person.test_classes.should == [test_class]
|
221
|
+
end
|
205
222
|
end
|
206
223
|
end
|
207
224
|
end
|
@@ -151,16 +151,6 @@ describe "A table" do
|
|
151
151
|
ActiveSupport::JSON.decode(row.values["misc:empty"]).class.should eql(Hash)
|
152
152
|
end
|
153
153
|
|
154
|
-
it "should display the previous value (versioning) of the column 'info:first_name'" do
|
155
|
-
pending "should we implement this, Vincent? :-)"
|
156
|
-
|
157
|
-
row = @table.first
|
158
|
-
row.values["info:first_name"].should eql("Bob")
|
159
|
-
|
160
|
-
prev_row = row.prev
|
161
|
-
prev_row.values["info:first_name"].should eql("John")
|
162
|
-
end
|
163
|
-
|
164
154
|
it "should be able to perform partial updates" do
|
165
155
|
row = @table.first(:select => ["misc"])
|
166
156
|
row.update_columns({ :misc => { :genre => "M" } })
|