couchbase-model-relationship 0.1.6 → 0.1.7

Sign up to get free protection for your applications and to get access to all the features.
@@ -71,6 +71,12 @@ module Couchbase
71
71
  end
72
72
 
73
73
  module ClassMethods
74
+ def inherited(base)
75
+ base.class_eval do
76
+ @_children = child_associations
77
+ end
78
+ end
79
+
74
80
  def child(name, options = {})
75
81
  # TODO This may get the full module path for a relationship name,
76
82
  # and that will make the keys very long. Is this necessary? see: AR STI
@@ -1,7 +1,7 @@
1
1
  module Couchbase
2
2
  class Model
3
3
  module Relationship
4
- VERSION = "0.1.6"
4
+ VERSION = "0.1.7"
5
5
  end
6
6
  end
7
7
  end
data/spec/parent_spec.rb CHANGED
@@ -21,6 +21,9 @@ class ParentTest < Couchbase::Model
21
21
  child :dont_load, auto_load: false
22
22
  end
23
23
 
24
+ class InheritanceTest < ParentTest
25
+ end
26
+
24
27
  class AutoSaveTest < Couchbase::Model
25
28
  include ActiveModel::Validations
26
29
 
@@ -54,6 +57,10 @@ describe "parent" do
54
57
  subject.should respond_to(:child)
55
58
  end
56
59
 
60
+ it "passes on it's children" do
61
+ InheritanceTest.child_association_names.should eq(ParentTest.child_association_names)
62
+ end
63
+
57
64
  context "the getter" do
58
65
  let(:association) { ParentTest.child_association_for :child }
59
66
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: couchbase-model-relationship
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.6
4
+ version: 0.1.7
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-10-24 00:00:00.000000000 Z
12
+ date: 2013-11-11 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activemodel
@@ -218,7 +218,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
218
218
  version: '0'
219
219
  segments:
220
220
  - 0
221
- hash: 4181024762891578791
221
+ hash: 1987298715392037877
222
222
  required_rubygems_version: !ruby/object:Gem::Requirement
223
223
  none: false
224
224
  requirements:
@@ -227,7 +227,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
227
227
  version: '0'
228
228
  segments:
229
229
  - 0
230
- hash: 4181024762891578791
230
+ hash: 1987298715392037877
231
231
  requirements: []
232
232
  rubyforge_project:
233
233
  rubygems_version: 1.8.24