ripple 0.9.5 → 1.0.0.beta
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +32 -0
- data/Gemfile +10 -9
- data/Guardfile +15 -0
- data/Rakefile +11 -40
- data/lib/rails/generators/ripple/configuration/configuration_generator.rb +0 -13
- data/lib/rails/generators/ripple/configuration/templates/ripple.yml +4 -4
- data/lib/rails/generators/ripple/js/js_generator.rb +0 -13
- data/lib/rails/generators/ripple/js/templates/js/contrib.js +0 -17
- data/lib/rails/generators/ripple/js/templates/js/ripple.js +0 -13
- data/lib/rails/generators/ripple/model/model_generator.rb +0 -14
- data/lib/rails/generators/ripple/model/templates/model.rb +1 -1
- data/lib/rails/generators/ripple/observer/observer_generator.rb +0 -14
- data/lib/rails/generators/ripple/test/test_generator.rb +7 -19
- data/lib/rails/generators/ripple_generator.rb +1 -14
- data/lib/ripple.rb +7 -14
- data/lib/ripple/associations.rb +129 -26
- data/lib/ripple/associations/embedded.rb +1 -15
- data/lib/ripple/associations/instantiators.rb +0 -13
- data/lib/ripple/associations/linked.rb +41 -19
- data/lib/ripple/associations/many.rb +0 -14
- data/lib/ripple/associations/many_embedded_proxy.rb +0 -14
- data/lib/ripple/associations/many_linked_proxy.rb +39 -18
- data/lib/ripple/associations/many_reference_proxy.rb +93 -0
- data/lib/ripple/associations/many_stored_key_proxy.rb +76 -0
- data/lib/ripple/associations/one.rb +1 -15
- data/lib/ripple/associations/one_embedded_proxy.rb +0 -14
- data/lib/ripple/associations/one_key_proxy.rb +58 -0
- data/lib/ripple/associations/one_linked_proxy.rb +4 -14
- data/lib/ripple/associations/one_stored_key_proxy.rb +43 -0
- data/lib/ripple/associations/proxy.rb +8 -14
- data/lib/ripple/attribute_methods.rb +19 -17
- data/lib/ripple/attribute_methods/dirty.rb +19 -15
- data/lib/ripple/attribute_methods/query.rb +0 -14
- data/lib/ripple/attribute_methods/read.rb +0 -14
- data/lib/ripple/attribute_methods/write.rb +0 -14
- data/lib/ripple/callbacks.rb +10 -16
- data/lib/ripple/conflict/basic_resolver.rb +82 -0
- data/lib/ripple/conflict/document_hooks.rb +20 -0
- data/lib/ripple/conflict/resolver.rb +71 -0
- data/lib/ripple/conflict/test_helper.rb +33 -0
- data/lib/ripple/conversion.rb +0 -14
- data/lib/ripple/core_ext.rb +1 -14
- data/lib/ripple/core_ext/casting.rb +19 -19
- data/lib/ripple/core_ext/object.rb +8 -0
- data/lib/ripple/document.rb +21 -16
- data/lib/ripple/document/bucket_access.rb +0 -14
- data/lib/ripple/document/finders.rb +17 -23
- data/lib/ripple/document/key.rb +8 -28
- data/lib/ripple/document/link.rb +30 -0
- data/lib/ripple/document/persistence.rb +12 -20
- data/lib/ripple/embedded_document.rb +10 -15
- data/lib/ripple/embedded_document/around_callbacks.rb +18 -0
- data/lib/ripple/embedded_document/finders.rb +7 -18
- data/lib/ripple/embedded_document/persistence.rb +5 -17
- data/lib/ripple/i18n.rb +0 -14
- data/lib/ripple/inspection.rb +21 -15
- data/lib/ripple/locale/en.yml +9 -13
- data/lib/ripple/nested_attributes.rb +33 -39
- data/lib/ripple/observable.rb +0 -13
- data/lib/ripple/properties.rb +1 -14
- data/lib/ripple/property_type_mismatch.rb +0 -14
- data/lib/ripple/railtie.rb +4 -14
- data/lib/ripple/railties/ripple.rake +86 -0
- data/lib/ripple/serialization.rb +11 -11
- data/lib/ripple/test_server.rb +36 -0
- data/lib/ripple/timestamps.rb +0 -13
- data/lib/ripple/translation.rb +4 -14
- data/lib/ripple/validations.rb +1 -15
- data/lib/ripple/validations/associated_validator.rb +26 -17
- data/lib/ripple/version.rb +3 -0
- data/ripple.gemspec +24 -35
- data/spec/integration/ripple/associations_spec.rb +89 -58
- data/spec/integration/ripple/conflict_resolution_spec.rb +298 -0
- data/spec/integration/ripple/nested_attributes_spec.rb +19 -19
- data/spec/integration/ripple/persistence_spec.rb +15 -34
- data/spec/integration/ripple/search_associations_spec.rb +31 -0
- data/spec/ripple/associations/many_embedded_proxy_spec.rb +23 -36
- data/spec/ripple/associations/many_linked_proxy_spec.rb +133 -45
- data/spec/ripple/associations/many_reference_proxy_spec.rb +170 -0
- data/spec/ripple/associations/many_stored_key_proxy_spec.rb +158 -0
- data/spec/ripple/associations/one_embedded_proxy_spec.rb +24 -37
- data/spec/ripple/associations/one_key_proxy_spec.rb +82 -0
- data/spec/ripple/associations/one_linked_proxy_spec.rb +22 -23
- data/spec/ripple/associations/one_stored_key_proxy_spec.rb +72 -0
- data/spec/ripple/associations/proxy_spec.rb +21 -15
- data/spec/ripple/associations_spec.rb +54 -23
- data/spec/ripple/attribute_methods/dirty_spec.rb +56 -5
- data/spec/ripple/attribute_methods_spec.rb +47 -21
- data/spec/ripple/bucket_access_spec.rb +4 -17
- data/spec/ripple/callbacks_spec.rb +52 -15
- data/spec/ripple/conflict/resolver_spec.rb +42 -0
- data/spec/ripple/conversion_spec.rb +2 -15
- data/spec/ripple/core_ext_spec.rb +12 -15
- data/spec/ripple/document/link_spec.rb +67 -0
- data/spec/ripple/document_spec.rb +34 -19
- data/spec/ripple/embedded_document/finders_spec.rb +12 -19
- data/spec/ripple/embedded_document/persistence_spec.rb +20 -26
- data/spec/ripple/embedded_document_spec.rb +44 -34
- data/spec/ripple/finders_spec.rb +58 -29
- data/spec/ripple/inspection_spec.rb +40 -37
- data/spec/ripple/key_spec.rb +5 -17
- data/spec/ripple/observable_spec.rb +3 -16
- data/spec/ripple/persistence_spec.rb +134 -18
- data/spec/ripple/properties_spec.rb +21 -15
- data/spec/ripple/ripple_spec.rb +1 -14
- data/spec/ripple/serialization_spec.rb +16 -17
- data/spec/ripple/timestamps_spec.rb +73 -52
- data/spec/ripple/validations/associated_validator_spec.rb +69 -25
- data/spec/ripple/validations_spec.rb +3 -16
- data/spec/spec_helper.rb +17 -18
- data/spec/support/associations.rb +1 -1
- data/spec/support/associations/proxies.rb +0 -13
- data/spec/support/integration_setup.rb +11 -0
- data/spec/support/mocks.rb +0 -13
- data/spec/support/models.rb +33 -2
- data/spec/support/models/address.rb +1 -16
- data/spec/support/models/box.rb +7 -14
- data/spec/support/models/car.rb +27 -1
- data/spec/support/models/cardboard_box.rb +0 -14
- data/spec/support/models/clock.rb +6 -15
- data/spec/support/models/clock_observer.rb +0 -14
- data/spec/support/models/credit_card.rb +5 -0
- data/spec/support/models/customer.rb +0 -14
- data/spec/support/models/email.rb +0 -14
- data/spec/support/models/family.rb +1 -13
- data/spec/support/models/favorite.rb +0 -14
- data/spec/support/models/invoice.rb +0 -14
- data/spec/support/models/late_invoice.rb +0 -14
- data/spec/support/models/nested.rb +12 -0
- data/spec/support/models/ninja.rb +7 -0
- data/spec/support/models/note.rb +0 -14
- data/spec/support/models/page.rb +1 -15
- data/spec/support/models/paid_invoice.rb +0 -14
- data/spec/support/models/post.rb +12 -0
- data/spec/support/models/profile.rb +7 -0
- data/spec/support/models/subscription.rb +26 -0
- data/spec/support/models/tasks.rb +0 -18
- data/spec/support/models/team.rb +11 -0
- data/spec/support/models/transactions.rb +17 -0
- data/spec/support/models/tree.rb +2 -16
- data/spec/support/models/user.rb +14 -16
- data/spec/support/models/widget.rb +8 -14
- data/spec/support/search.rb +14 -0
- data/spec/support/test_server.rb +22 -12
- data/spec/support/test_server.yml.example +14 -2
- metadata +223 -59
- data/lib/rails/generators/ripple/test/templates/test_server.rb +0 -46
- data/spec/support/models/driver.rb +0 -5
- data/spec/support/models/engine.rb +0 -4
- data/spec/support/models/passenger.rb +0 -5
- data/spec/support/models/seat.rb +0 -4
- data/spec/support/models/wheel.rb +0 -5
@@ -1,33 +1,77 @@
|
|
1
|
-
|
2
|
-
#
|
3
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
-
# you may not use this file except in compliance with the License.
|
5
|
-
# You may obtain a copy of the License at
|
6
|
-
#
|
7
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
8
|
-
#
|
9
|
-
# Unless required by applicable law or agreed to in writing, software
|
10
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
-
# See the License for the specific language governing permissions and
|
13
|
-
# limitations under the License.
|
14
|
-
require File.expand_path("../../../spec_helper", __FILE__)
|
1
|
+
require 'spec_helper'
|
15
2
|
|
16
3
|
describe Ripple::Validations::AssociatedValidator do
|
17
|
-
|
4
|
+
context 'for a one association' do
|
5
|
+
# require 'support/models/family'
|
18
6
|
|
19
|
-
|
20
|
-
|
21
|
-
|
7
|
+
let(:child) { Child.new }
|
8
|
+
let(:parent) { Parent.new }
|
9
|
+
before(:each) { parent.child = child }
|
22
10
|
|
23
|
-
|
24
|
-
|
25
|
-
|
11
|
+
it "is invalid when the associated record is invalid" do
|
12
|
+
child.should_not be_valid
|
13
|
+
parent.should_not be_valid
|
14
|
+
end
|
15
|
+
|
16
|
+
it "includes the associated record's validation error messages in the error message" do
|
17
|
+
parent.valid?
|
18
|
+
parent.errors[:child].size.should == 1
|
19
|
+
parent.errors[:child].first.should =~ /is invalid \(Name can't be blank and Age can't be blank\)/
|
20
|
+
end
|
21
|
+
|
22
|
+
it "is valid when the associated record is valid" do
|
23
|
+
child.name = 'Coen'
|
24
|
+
child.age = 1
|
25
|
+
child.should be_valid
|
26
|
+
parent.should be_valid
|
27
|
+
end
|
26
28
|
end
|
27
29
|
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
30
|
+
context 'for a many association' do
|
31
|
+
# require 'support/models/team'
|
32
|
+
|
33
|
+
let(:team) { Team.new }
|
34
|
+
let(:ichiro) { Player.new(:name => 'Ichiro', :position => 'Right Field') }
|
35
|
+
let(:satchel_paige) { Player.new(:position => 'Pitcher') }
|
36
|
+
let(:unknown) { Player.new }
|
37
|
+
|
38
|
+
before(:each) do
|
39
|
+
team.players << ichiro
|
40
|
+
team.players << satchel_paige
|
41
|
+
team.players << unknown
|
42
|
+
end
|
43
|
+
|
44
|
+
it 'is invalid when the associated records are invalid' do
|
45
|
+
satchel_paige.should_not be_valid
|
46
|
+
unknown.should_not be_valid
|
47
|
+
team.should_not be_valid
|
48
|
+
end
|
49
|
+
|
50
|
+
it "includes the associated records' validation error messages in the error message" do
|
51
|
+
team.valid?
|
52
|
+
team.errors[:players].size.should == 1
|
53
|
+
|
54
|
+
expected_errors = [
|
55
|
+
"for player 2: Name can't be blank",
|
56
|
+
"for player 3: Name can't be blank and Position can't be blank"
|
57
|
+
]
|
58
|
+
|
59
|
+
expected_errors = expected_errors.join('; ')
|
60
|
+
team.errors[:players].first.should == "are invalid (#{expected_errors})"
|
61
|
+
end
|
62
|
+
|
63
|
+
it 'is valid when the associated records are all valid' do
|
64
|
+
ichiro.position = 'Right Field'
|
65
|
+
ichiro.should be_valid
|
66
|
+
|
67
|
+
satchel_paige.name = 'Satchel Paige'
|
68
|
+
satchel_paige.should be_valid
|
69
|
+
|
70
|
+
unknown.name = 'John Doe'
|
71
|
+
unknown.position = 'First Base'
|
72
|
+
unknown.should be_valid
|
73
|
+
|
74
|
+
team.should be_valid
|
75
|
+
end
|
32
76
|
end
|
33
77
|
end
|
@@ -1,20 +1,7 @@
|
|
1
|
-
|
2
|
-
#
|
3
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
-
# you may not use this file except in compliance with the License.
|
5
|
-
# You may obtain a copy of the License at
|
6
|
-
#
|
7
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
8
|
-
#
|
9
|
-
# Unless required by applicable law or agreed to in writing, software
|
10
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
-
# See the License for the specific language governing permissions and
|
13
|
-
# limitations under the License.
|
14
|
-
require File.expand_path("../../spec_helper", __FILE__)
|
1
|
+
require 'spec_helper'
|
15
2
|
|
16
3
|
describe Ripple::Validations do
|
17
|
-
require 'support/models/box'
|
4
|
+
# require 'support/models/box'
|
18
5
|
|
19
6
|
before :each do
|
20
7
|
@box = Box.new
|
@@ -77,7 +64,7 @@ describe Ripple::Validations do
|
|
77
64
|
end
|
78
65
|
|
79
66
|
it "should allow unexpected exceptions to be raised" do
|
80
|
-
robject = mock("robject", :key => @box.key, "data=" => true)
|
67
|
+
robject = mock("robject", :key => @box.key, "data=" => true, "content_type=" => true)
|
81
68
|
robject.should_receive(:store).and_raise(Riak::HTTPFailedRequest.new(:post, 200, 404, {}, "404 not found"))
|
82
69
|
@box.stub!(:robject).and_return(robject)
|
83
70
|
@box.stub!(:valid?).and_return(true)
|
data/spec/spec_helper.rb
CHANGED
@@ -1,33 +1,32 @@
|
|
1
|
-
# Copyright 2010 Sean Cribbs, Sonian Inc., and Basho Technologies, Inc.
|
2
|
-
#
|
3
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
-
# you may not use this file except in compliance with the License.
|
5
|
-
# You may obtain a copy of the License at
|
6
|
-
#
|
7
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
8
|
-
#
|
9
|
-
# Unless required by applicable law or agreed to in writing, software
|
10
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
-
# See the License for the specific language governing permissions and
|
13
|
-
# limitations under the License.
|
14
1
|
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
15
2
|
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
16
3
|
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', '..', 'riak-client','lib'))
|
17
4
|
|
18
5
|
require 'rubygems' # Use the gems path only for the spec suite
|
19
6
|
require 'ripple'
|
7
|
+
require 'ripple/conflict/test_helper'
|
20
8
|
require 'rspec'
|
21
9
|
|
22
|
-
|
10
|
+
# Only the tests should really get away with this.
|
11
|
+
Riak.disable_list_keys_warnings = true
|
12
|
+
|
13
|
+
%w[
|
14
|
+
integration_setup
|
15
|
+
mocks
|
16
|
+
test_server
|
17
|
+
search
|
18
|
+
models
|
19
|
+
associations
|
20
|
+
].each do |file|
|
21
|
+
require File.join("support", file)
|
22
|
+
end
|
23
23
|
|
24
24
|
RSpec.configure do |config|
|
25
25
|
config.mock_with :rspec
|
26
|
-
config.after(:each) do
|
27
|
-
$test_server.recycle if $test_server
|
28
|
-
end
|
29
26
|
|
30
|
-
config.
|
27
|
+
config.treat_symbols_as_metadata_keys_with_true_values = true
|
28
|
+
config.filter_run :focus
|
31
29
|
config.run_all_when_everything_filtered = true
|
32
30
|
config.debug = true
|
31
|
+
config.include Ripple::Conflict::TestHelper
|
33
32
|
end
|
@@ -1 +1 @@
|
|
1
|
-
require
|
1
|
+
require 'support/associations/proxies'
|
@@ -1,16 +1,3 @@
|
|
1
|
-
# Copyright 2010 Sean Cribbs, Sonian Inc., and Basho Technologies, Inc.
|
2
|
-
#
|
3
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
-
# you may not use this file except in compliance with the License.
|
5
|
-
# You may obtain a copy of the License at
|
6
|
-
#
|
7
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
8
|
-
#
|
9
|
-
# Unless required by applicable law or agreed to in writing, software
|
10
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
-
# See the License for the specific language governing permissions and
|
13
|
-
# limitations under the License.
|
14
1
|
|
15
2
|
|
16
3
|
class FakeNilProxy < Ripple::Associations::Proxy
|
@@ -0,0 +1,11 @@
|
|
1
|
+
# auto-tag all integration specs with :integration => true
|
2
|
+
module IntegrationSpecs
|
3
|
+
def self.included(klass)
|
4
|
+
klass.metadata[:integration] = true
|
5
|
+
end
|
6
|
+
end
|
7
|
+
|
8
|
+
RSpec.configure do |config|
|
9
|
+
config.include IntegrationSpecs, :example_group => { :file_path => %r{spec/integration} }
|
10
|
+
end
|
11
|
+
|
data/spec/support/mocks.rb
CHANGED
@@ -1,16 +1,3 @@
|
|
1
|
-
# Copyright 2010 Sean Cribbs, Sonian Inc., and Basho Technologies, Inc.
|
2
|
-
#
|
3
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
-
# you may not use this file except in compliance with the License.
|
5
|
-
# You may obtain a copy of the License at
|
6
|
-
#
|
7
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
8
|
-
#
|
9
|
-
# Unless required by applicable law or agreed to in writing, software
|
10
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
-
# See the License for the specific language governing permissions and
|
13
|
-
# limitations under the License.
|
14
1
|
|
15
2
|
def mock_response(overrides={})
|
16
3
|
{:headers => {"content-type" => ["application/json"]}, :body => '{}'}.merge(overrides)
|
data/spec/support/models.rb
CHANGED
@@ -1,3 +1,34 @@
|
|
1
|
-
|
2
|
-
require
|
1
|
+
# You MUST add models to this file, in the correct order by
|
2
|
+
# dependency (no deps at top). There is no auto-require.
|
3
|
+
%w[
|
4
|
+
note
|
5
|
+
page
|
6
|
+
box
|
7
|
+
car
|
8
|
+
clock
|
9
|
+
customer
|
10
|
+
email
|
11
|
+
family
|
12
|
+
favorite
|
13
|
+
subscription
|
14
|
+
team
|
15
|
+
transactions
|
16
|
+
tree
|
17
|
+
widget
|
18
|
+
address
|
19
|
+
cardboard_box
|
20
|
+
clock_observer
|
21
|
+
invoice
|
22
|
+
paid_invoice
|
23
|
+
late_invoice
|
24
|
+
company
|
25
|
+
profile
|
26
|
+
user
|
27
|
+
ninja
|
28
|
+
tasks
|
29
|
+
credit_card
|
30
|
+
post
|
31
|
+
nested
|
32
|
+
].each do |file|
|
33
|
+
require File.join("support", "models", file)
|
3
34
|
end
|
@@ -1,22 +1,7 @@
|
|
1
|
-
# Copyright 2010 Sean Cribbs, Sonian Inc., and Basho Technologies, Inc.
|
2
|
-
#
|
3
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
-
# you may not use this file except in compliance with the License.
|
5
|
-
# You may obtain a copy of the License at
|
6
|
-
#
|
7
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
8
|
-
#
|
9
|
-
# Unless required by applicable law or agreed to in writing, software
|
10
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
-
# See the License for the specific language governing permissions and
|
13
|
-
# limitations under the License.
|
14
|
-
|
15
|
-
require 'support/models/note'
|
16
|
-
|
17
1
|
class Address
|
18
2
|
include Ripple::EmbeddedDocument
|
19
3
|
property :street, String, :presence => true
|
4
|
+
property :kind, String, :presence => true
|
20
5
|
many :notes
|
21
6
|
embedded_in :user
|
22
7
|
end
|
data/spec/support/models/box.rb
CHANGED
@@ -1,19 +1,12 @@
|
|
1
|
-
# Copyright 2010 Sean Cribbs, Sonian Inc., and Basho Technologies, Inc.
|
2
|
-
#
|
3
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
-
# you may not use this file except in compliance with the License.
|
5
|
-
# You may obtain a copy of the License at
|
6
|
-
#
|
7
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
8
|
-
#
|
9
|
-
# Unless required by applicable law or agreed to in writing, software
|
10
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
-
# See the License for the specific language governing permissions and
|
13
|
-
# limitations under the License.
|
14
|
-
|
15
1
|
class Box
|
16
2
|
include Ripple::Document
|
17
3
|
property :shape, String
|
4
|
+
many :sides, :class_name => 'BoxSide'
|
18
5
|
timestamps!
|
19
6
|
end
|
7
|
+
|
8
|
+
class BoxSide
|
9
|
+
include Ripple::EmbeddedDocument
|
10
|
+
embedded_in :box
|
11
|
+
property :material, String
|
12
|
+
end
|
data/spec/support/models/car.rb
CHANGED
@@ -1,6 +1,32 @@
|
|
1
|
+
class Driver
|
2
|
+
include Ripple::Document
|
3
|
+
property :name, String
|
4
|
+
key_on :name
|
5
|
+
end
|
6
|
+
|
7
|
+
class Passenger
|
8
|
+
include Ripple::Document
|
9
|
+
property :name, String
|
10
|
+
end
|
11
|
+
|
12
|
+
class Engine
|
13
|
+
include Ripple::EmbeddedDocument
|
14
|
+
property :displacement, String
|
15
|
+
end
|
16
|
+
|
17
|
+
class Wheel
|
18
|
+
include Ripple::Document
|
19
|
+
property :diameter, Integer
|
20
|
+
end
|
21
|
+
|
22
|
+
class Seat
|
23
|
+
include Ripple::EmbeddedDocument
|
24
|
+
property :color, String
|
25
|
+
end
|
26
|
+
|
1
27
|
class Car
|
2
28
|
include Ripple::Document
|
3
|
-
|
29
|
+
|
4
30
|
property :make, String
|
5
31
|
property :model, String
|
6
32
|
|
@@ -1,16 +1,2 @@
|
|
1
|
-
# Copyright 2010 Sean Cribbs, Sonian Inc., and Basho Technologies, Inc.
|
2
|
-
#
|
3
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
-
# you may not use this file except in compliance with the License.
|
5
|
-
# You may obtain a copy of the License at
|
6
|
-
#
|
7
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
8
|
-
#
|
9
|
-
# Unless required by applicable law or agreed to in writing, software
|
10
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
-
# See the License for the specific language governing permissions and
|
13
|
-
# limitations under the License.
|
14
|
-
|
15
1
|
class CardboardBox < Box
|
16
2
|
end
|
@@ -1,19 +1,10 @@
|
|
1
|
-
# Copyright 2010 Sean Cribbs, Sonian Inc., and Basho Technologies, Inc.
|
2
|
-
#
|
3
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
-
# you may not use this file except in compliance with the License.
|
5
|
-
# You may obtain a copy of the License at
|
6
|
-
#
|
7
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
8
|
-
#
|
9
|
-
# Unless required by applicable law or agreed to in writing, software
|
10
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
-
# See the License for the specific language governing permissions and
|
13
|
-
# limitations under the License.
|
14
|
-
|
15
|
-
|
16
1
|
class Clock
|
17
2
|
include Ripple::Document
|
18
3
|
timestamps!
|
4
|
+
many :modes
|
5
|
+
end
|
6
|
+
|
7
|
+
class Mode
|
8
|
+
include Ripple::EmbeddedDocument
|
9
|
+
timestamps!
|
19
10
|
end
|
@@ -1,16 +1,2 @@
|
|
1
|
-
# Copyright 2010 Sean Cribbs, Sonian Inc., and Basho Technologies, Inc.
|
2
|
-
#
|
3
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
-
# you may not use this file except in compliance with the License.
|
5
|
-
# You may obtain a copy of the License at
|
6
|
-
#
|
7
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
8
|
-
#
|
9
|
-
# Unless required by applicable law or agreed to in writing, software
|
10
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
-
# See the License for the specific language governing permissions and
|
13
|
-
# limitations under the License.
|
14
|
-
|
15
1
|
class ClockObserver < ActiveModel::Observer
|
16
2
|
end
|
@@ -1,17 +1,3 @@
|
|
1
|
-
# Copyright 2010 Sean Cribbs, Sonian Inc., and Basho Technologies, Inc.
|
2
|
-
#
|
3
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
-
# you may not use this file except in compliance with the License.
|
5
|
-
# You may obtain a copy of the License at
|
6
|
-
#
|
7
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
8
|
-
#
|
9
|
-
# Unless required by applicable law or agreed to in writing, software
|
10
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
-
# See the License for the specific language governing permissions and
|
13
|
-
# limitations under the License.
|
14
|
-
|
15
1
|
class Customer
|
16
2
|
include Ripple::Document
|
17
3
|
end
|