tenacity 0.4.1 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (71) hide show
  1. data/.gitignore +1 -0
  2. data/EXTEND.rdoc +18 -21
  3. data/Gemfile +0 -2
  4. data/README.rdoc +3 -1
  5. data/Rakefile +7 -0
  6. data/history.txt +17 -0
  7. data/lib/tenacity.rb +4 -0
  8. data/lib/tenacity/associates_proxy.rb +5 -7
  9. data/lib/tenacity/association.rb +9 -47
  10. data/lib/tenacity/associations/belongs_to.rb +1 -2
  11. data/lib/tenacity/associations/has_many.rb +27 -21
  12. data/lib/tenacity/associations/has_one.rb +3 -2
  13. data/lib/tenacity/class_methods.rb +14 -60
  14. data/lib/tenacity/errors.rb +8 -0
  15. data/lib/tenacity/instance_methods.rb +42 -12
  16. data/lib/tenacity/orm_ext/activerecord.rb +11 -32
  17. data/lib/tenacity/orm_ext/couchrest.rb +14 -22
  18. data/lib/tenacity/orm_ext/datamapper.rb +14 -31
  19. data/lib/tenacity/orm_ext/helpers.rb +3 -3
  20. data/lib/tenacity/orm_ext/mongo_mapper.rb +16 -22
  21. data/lib/tenacity/orm_ext/mongoid.rb +10 -18
  22. data/lib/tenacity/orm_ext/ripple.rb +270 -0
  23. data/lib/tenacity/orm_ext/sequel.rb +21 -33
  24. data/lib/tenacity/orm_ext/toystore.rb +114 -0
  25. data/lib/tenacity/version.rb +1 -1
  26. data/tenacity.gemspec +10 -3
  27. data/test/association_features/belongs_to_test.rb +12 -0
  28. data/test/association_features/has_many_test.rb +32 -2
  29. data/test/association_features/has_one_test.rb +18 -4
  30. data/test/associations/has_one_test.rb +0 -1
  31. data/test/core/classmethods_test.rb +7 -0
  32. data/test/fixtures/active_record_has_many_target.rb +4 -0
  33. data/test/fixtures/active_record_has_one_target.rb +4 -0
  34. data/test/fixtures/active_record_object.rb +8 -0
  35. data/test/fixtures/couch_rest_has_many_target.rb +4 -0
  36. data/test/fixtures/couch_rest_has_one_target.rb +4 -0
  37. data/test/fixtures/couch_rest_object.rb +8 -0
  38. data/test/fixtures/data_mapper_has_many_target.rb +10 -0
  39. data/test/fixtures/data_mapper_has_one_target.rb +10 -0
  40. data/test/fixtures/data_mapper_object.rb +8 -0
  41. data/test/fixtures/mongo_mapper_has_many_target.rb +4 -0
  42. data/test/fixtures/mongo_mapper_has_one_target.rb +4 -0
  43. data/test/fixtures/mongo_mapper_object.rb +8 -0
  44. data/test/fixtures/mongoid_has_many_target.rb +4 -0
  45. data/test/fixtures/mongoid_has_one_target.rb +4 -0
  46. data/test/fixtures/mongoid_object.rb +8 -0
  47. data/test/fixtures/no_associations.rb +4 -0
  48. data/test/fixtures/ripple_has_many_target.rb +24 -0
  49. data/test/fixtures/ripple_has_one_target.rb +24 -0
  50. data/test/fixtures/ripple_object.rb +42 -0
  51. data/test/fixtures/sequel_has_many_target.rb +4 -0
  52. data/test/fixtures/sequel_has_one_target.rb +4 -0
  53. data/test/fixtures/sequel_object.rb +8 -0
  54. data/test/fixtures/toystore_has_many_target.rb +28 -0
  55. data/test/fixtures/toystore_has_one_target.rb +28 -0
  56. data/test/fixtures/toystore_object.rb +46 -0
  57. data/test/helpers/active_record_test_helper.rb +12 -95
  58. data/test/helpers/data_mapper_test_helper.rb +0 -64
  59. data/test/helpers/ripple_test_helper.rb +19 -0
  60. data/test/helpers/sequel_test_helper.rb +13 -60
  61. data/test/helpers/toystore_test_helper.rb +17 -0
  62. data/test/orm_ext/activerecord_test.rb +16 -26
  63. data/test/orm_ext/couchrest_test.rb +10 -29
  64. data/test/orm_ext/datamapper_test.rb +16 -29
  65. data/test/orm_ext/mongo_mapper_test.rb +11 -29
  66. data/test/orm_ext/mongoid_test.rb +11 -29
  67. data/test/orm_ext/ripple_test.rb +140 -0
  68. data/test/orm_ext/sequel_test.rb +15 -26
  69. data/test/orm_ext/toystore_test.rb +103 -0
  70. data/test/test_helper.rb +35 -23
  71. metadata +99 -133
@@ -32,15 +32,8 @@ module Tenacity
32
32
  #
33
33
  # == t_has_many
34
34
  #
35
- # The +t_has_many+ association requires that a join table exist to store the
36
- # associations. The name of the join table follows ActiveRecord conventions.
37
- # The name of the join table in this example would be cars_wheels, since cars
38
- # comes before wheels when shorted alphabetically.
39
- #
40
- # DB.create_table :cars_wheels do
41
- # Integer :car_id
42
- # String :wheel_id
43
- # end
35
+ # The +t_has_many+ association requires nothing special, as the associates
36
+ # are looked up using the associate class.
44
37
  #
45
38
  module Sequel
46
39
 
@@ -79,7 +72,12 @@ module Tenacity
79
72
  end
80
73
 
81
74
  def _t_find_all_by_associate(property, id)
82
- filter(property => _t_serialize(id)).to_a
75
+ filter(property.to_sym => _t_serialize(id)).to_a
76
+ end
77
+
78
+ def _t_find_all_ids_by_associate(property, id)
79
+ results = db["SELECT id FROM #{table_name} WHERE #{property} = #{_t_serialize_id_for_sql(id)}"].all
80
+ results.map { |r| r[:id] }
83
81
  end
84
82
 
85
83
  def _t_initialize_tenacity
@@ -112,6 +110,11 @@ module Tenacity
112
110
  module InstanceMethods #:nodoc:
113
111
  include Tenacity::OrmExt::Helpers
114
112
 
113
+ def before_save
114
+ _t_verify_associates_exist
115
+ super
116
+ end
117
+
115
118
  def after_save
116
119
  _t_save_autosave_associations
117
120
 
@@ -120,10 +123,7 @@ module Tenacity
120
123
  super
121
124
  end
122
125
 
123
- def after_destroy
124
- associations = self.class._t_belongs_to_associations || []
125
- associations.each { |association| self._t_cleanup_belongs_to_association(association) }
126
-
126
+ def before_destroy
127
127
  associations = self.class._t_has_one_associations || []
128
128
  associations.each { |association| self._t_cleanup_has_one_association(association) }
129
129
 
@@ -132,27 +132,15 @@ module Tenacity
132
132
  super
133
133
  end
134
134
 
135
- def _t_reload
136
- reload
137
- end
138
-
139
- def _t_clear_associates(association)
140
- db["delete from #{association.join_table} where #{association.association_key} = #{_t_serialize_id_for_sql(self.id)}"].delete
141
- end
142
-
143
- def _t_associate_many(association, associate_ids)
144
- db.transaction do
145
- _t_clear_associates(association)
146
- associate_ids.each do |associate_id|
147
- db["insert into #{association.join_table} (#{association.association_key}, #{association.association_foreign_key}) values (#{_t_serialize_id_for_sql(self.id)}, #{_t_serialize_id_for_sql(associate_id)})"].insert
148
- end
149
- end
135
+ def after_destroy
136
+ associations = self.class._t_belongs_to_associations || []
137
+ associations.each { |association| self._t_cleanup_belongs_to_association(association) }
138
+ super
150
139
  end
151
140
 
152
- def _t_get_associate_ids(association)
153
- return [] if self.id.nil?
154
- rows = db["select #{association.association_foreign_key} from #{association.join_table} where #{association.association_key} = #{_t_serialize_id_for_sql(self.id)}"].all
155
- rows.map { |row| row[association.association_foreign_key.to_sym] }
141
+ def _t_reload
142
+ reload
143
+ self
156
144
  end
157
145
  end
158
146
 
@@ -0,0 +1,114 @@
1
+ module Tenacity
2
+ module OrmExt
3
+ #
4
+ # Tenacity relationships on Toystore objects require no special attributes
5
+ # defined on the object. Tenacity will define the attributes that it needs
6
+ # to support the relationships. Take the following class for example:
7
+ #
8
+ # class Car
9
+ # include Toy::Store
10
+ # store :mongo, Mongo::Connection.new.db('tenacity')['toystore']
11
+ # include Tenacity
12
+ #
13
+ # t_has_many :wheels
14
+ # t_has_one :dashboard
15
+ # t_belongs_to :driver
16
+ # end
17
+ #
18
+ # <b>Please note that the data store must be established before including the Tenacity module.</b>
19
+ #
20
+ # == t_belongs_to
21
+ #
22
+ # The +t_belongs_to+ association will define an attribute named after the association.
23
+ # The example above will create an attribute named <tt>:driver_id</tt>
24
+ #
25
+ #
26
+ # == t_has_one
27
+ #
28
+ # The +t_has_one+ association will not define any new attributes on the object, since
29
+ # the associated object holds the foreign key.
30
+ #
31
+ #
32
+ # == t_has_many
33
+ #
34
+ # The +t_has_many+ association will define an attribute named after the association.
35
+ # The example above will create attribute named <tt>:wheels_ids</tt>
36
+ #
37
+ module Toystore
38
+
39
+ def self.setup(model) #:nodoc:
40
+ require 'toystore'
41
+ if model.included_modules.include?(::Toy::Store)
42
+ model.send :include, Toystore::InstanceMethods
43
+ model.extend Toystore::ClassMethods
44
+ end
45
+ rescue LoadError
46
+ # Toystore not available
47
+ end
48
+
49
+ module ClassMethods #:nodoc:
50
+ include Tenacity::OrmExt::Helpers
51
+
52
+ def _t_id_type
53
+ String
54
+ end
55
+
56
+ def _t_find(id)
57
+ (id.nil? || id.to_s.strip == "") ? nil : get(_t_serialize(id))
58
+ end
59
+
60
+ def _t_find_bulk(ids)
61
+ get_multi(_t_serialize_ids(ids)).compact
62
+ end
63
+
64
+ def _t_find_first_by_associate(property, id)
65
+ send("first_by_#{property}", id)
66
+ end
67
+
68
+ def _t_find_all_by_associate(property, id)
69
+ get_multi(_t_find_all_ids_by_associate(property, id))
70
+ end
71
+
72
+ def _t_find_all_ids_by_associate(property, id)
73
+ get_index(property.to_sym, id)
74
+ end
75
+
76
+ def _t_initialize_tenacity
77
+ before_save { |record| record._t_verify_associates_exist }
78
+ after_save { |record| record._t_save_autosave_associations }
79
+ end
80
+
81
+ def _t_initialize_has_one_association(association)
82
+ before_destroy { |record| record._t_cleanup_has_one_association(association) }
83
+ end
84
+
85
+ def _t_initialize_has_many_association(association)
86
+ after_save { |record| self.class._t_save_associates(record, association) }
87
+ before_destroy { |record| record._t_cleanup_has_many_association(association) }
88
+ end
89
+
90
+ def _t_initialize_belongs_to_association(association)
91
+ attribute association.foreign_key, id_class_for(association)
92
+ attribute association.polymorphic_type, String if association.polymorphic?
93
+ index(association.foreign_key.to_sym)
94
+ after_destroy { |record| record._t_cleanup_belongs_to_association(association) }
95
+ end
96
+
97
+ def _t_delete(ids, run_callbacks=true)
98
+ if run_callbacks
99
+ destroy(*ids)
100
+ else
101
+ delete(*ids)
102
+ end
103
+ end
104
+ end
105
+
106
+ module InstanceMethods #:nodoc:
107
+ def _t_reload
108
+ reload
109
+ self
110
+ end
111
+ end
112
+ end
113
+ end
114
+ end
@@ -1,3 +1,3 @@
1
1
  module Tenacity
2
- VERSION = "0.4.1"
2
+ VERSION = "0.5.0"
3
3
  end
data/tenacity.gemspec CHANGED
@@ -33,13 +33,20 @@ Gem::Specification.new do |s|
33
33
  s.add_development_dependency "sequel", "~> 3.19.0"
34
34
 
35
35
  # MongoDB
36
- # mongo_mapper dependency defined in Gemfile
36
+ s.add_development_dependency "mongo_mapper", "~> 0.9.0"
37
37
  s.add_development_dependency "bson_ext", "~> 1.3.0"
38
- s.add_development_dependency "mongoid", "~> 2.0.0.beta"
38
+ s.add_development_dependency "mongoid", "~> 2.0.0"
39
39
 
40
40
  # CouchDB
41
41
  s.add_development_dependency "couchrest", "~> 1.0.0"
42
- s.add_development_dependency "couchrest_model", "~> 1.0.0.beta"
42
+ s.add_development_dependency "couchrest_model", "~> 1.0.0"
43
+
44
+ # Riak
45
+ s.add_development_dependency "ripple", "~> 0.9.2"
46
+
47
+ # Multiple
48
+ s.add_development_dependency "toystore", "~> 0.8.0"
49
+ s.add_development_dependency "adapter-mongo", "~> 0.5.2"
43
50
 
44
51
  s.files = `git ls-files`.split("\n")
45
52
  s.executables = `git ls-files`.split("\n").map{|f| f =~ /^bin\/(.*)/ ? $1 : nil}.compact
@@ -82,6 +82,18 @@ class BelongsToTest < Test::Unit::TestCase
82
82
  assert_equal alternator, MongoMapperCircuitBoard.find(circuit_board.id).diagnosable
83
83
  assert_equal 'MongoMapperAlternator', circuit_board.diagnosable_type
84
84
  end
85
+
86
+ should "not be able to create the relationship if the target object does not exist" do
87
+ ash_tray = MongoMapperAshTray.new(:mongo_mapper_dashboard_id => 'abc123')
88
+ assert_raises(Tenacity::ObjectDoesNotExistError) { ash_tray.save }
89
+ end
90
+
91
+ should "be able to create the relationship if the target object does not exist and foreign key constraints are disabled" do
92
+ Tenacity::Association.any_instance.stubs(:foreign_key_constraints_enabled?).returns(false)
93
+ ash_tray = MongoMapperAshTray.new(:mongo_mapper_dashboard_id => 'abc123')
94
+ ash_tray.save
95
+ assert_equal 'abc123', MongoMapperAshTray.find(ash_tray.id).mongo_mapper_dashboard_id
96
+ end
85
97
  end
86
98
 
87
99
  end
@@ -2,9 +2,11 @@ require 'test_helper'
2
2
 
3
3
  class HasManyTest < Test::Unit::TestCase
4
4
 
5
- context "A class with a belongs_to association to another class" do
5
+ context "A class with a has_many association to another class" do
6
6
  setup do
7
- setup_all_fixtures
7
+ setup_fixtures
8
+ setup_couchdb_fixtures
9
+
8
10
  @car = ActiveRecordCar.create
9
11
  @wheels = [MongoMapperWheel.create, MongoMapperWheel.create, MongoMapperWheel.create]
10
12
 
@@ -150,6 +152,34 @@ class HasManyTest < Test::Unit::TestCase
150
152
  assert_set_equal ['ActiveRecordEngine', 'ActiveRecordEngine', 'ActiveRecordEngine'], components.map {|c| c.diagnosable_type}
151
153
  end
152
154
 
155
+ context "with an a active t_belongs_to association that is not auto destroyed" do
156
+ setup do
157
+ @car = ActiveRecordCar.create
158
+ window_1 = MongoMapperWindow.create
159
+ window_2 = MongoMapperWindow.create
160
+ window_3 = MongoMapperWindow.create
161
+ window_4 = MongoMapperWindow.create
162
+ window_5 = MongoMapperWindow.create
163
+ window_6 = MongoMapperWindow.create
164
+ window_7 = MongoMapperWindow.create
165
+ window_8 = MongoMapperWindow.create
166
+ window_9 = MongoMapperWindow.create
167
+ @car.mongo_mapper_windows = [window_1, window_2, window_3, window_4, window_5, window_6, window_7, window_8, window_9]
168
+ @car.save
169
+ end
170
+
171
+ should "should not eligible for deletion" do
172
+ assert_raises(Tenacity::ObjectIdInUseError) { ActiveRecordCar._t_delete(@car.id) }
173
+ assert_not_nil ActiveRecordCar._t_find(@car.id)
174
+ end
175
+
176
+ should "should be eligible for deletion if foreign key constraints are disabled" do
177
+ Tenacity::Association.any_instance.stubs(:foreign_key_constraints_enabled?).returns(false)
178
+ ActiveRecordCar._t_delete(@car.id)
179
+ assert_nil ActiveRecordCar._t_find(@car.id)
180
+ end
181
+ end
182
+
153
183
  context "with an autosave association" do
154
184
  setup do
155
185
  @source = ActiveRecordObject.create
@@ -4,9 +4,11 @@ class HasOneTest < Test::Unit::TestCase
4
4
 
5
5
  context "A class with a has_one association to another class" do
6
6
  setup do
7
- setup_all_fixtures
8
- @climate_control_unit = ActiveRecordClimateControlUnit.create
9
- @dashboard = MongoMapperDashboard.create(:active_record_climate_control_unit => @climate_control_unit)
7
+ setup_fixtures
8
+ setup_couchdb_fixtures
9
+
10
+ @dashboard = MongoMapperDashboard.create
11
+ @climate_control_unit = ActiveRecordClimateControlUnit.create(:mongo_mapper_dashboard => @dashboard)
10
12
  end
11
13
 
12
14
  should "memoize the association" do
@@ -23,8 +25,9 @@ class HasOneTest < Test::Unit::TestCase
23
25
  end
24
26
 
25
27
  should "be able to specify the class name of the associated class" do
28
+ dashboard = MongoMapperDashboard.create
26
29
  ash_tray = MongoMapperAshTray.create
27
- dashboard = MongoMapperDashboard.create(:ash_tray => ash_tray)
30
+ dashboard.ash_tray = ash_tray
28
31
  assert_equal ash_tray, dashboard.ash_tray
29
32
  end
30
33
 
@@ -91,6 +94,17 @@ class HasOneTest < Test::Unit::TestCase
91
94
  assert_equal circuit_board, component
92
95
  assert_equal 'MongoMapperAlternator', component.diagnosable_type
93
96
  end
97
+
98
+ should "not be able to delete an object with an active t_belongs_to association" do
99
+ assert_raises(Tenacity::ObjectIdInUseError) { MongoMapperDashboard._t_delete(@dashboard.id) }
100
+ assert_not_nil MongoMapperDashboard._t_find(@dashboard.id)
101
+ end
102
+
103
+ should "be able to delete an object with an active t_belongs_to association if foreign key constraints are disabled" do
104
+ Tenacity::Association.any_instance.stubs(:foreign_key_constraints_enabled?).returns(false)
105
+ MongoMapperDashboard._t_delete(@dashboard.id)
106
+ assert_nil MongoMapperDashboard._t_find(@dashboard.id)
107
+ end
94
108
  end
95
109
 
96
110
  end
@@ -26,7 +26,6 @@ class HasOneTest < Test::Unit::TestCase
26
26
  end
27
27
 
28
28
  should "be able to invoke the post delete callback" do
29
- @source.send("#{@foreign_key}=", @target)
30
29
  @source_class._t_delete([serialize_id(@source)])
31
30
  end
32
31
 
@@ -35,6 +35,13 @@ class ClassmethodsTest < Test::Unit::TestCase
35
35
  should("respond to mongo_mapper_has_many_target_ids=") { assert @object.respond_to?(:mongo_mapper_has_many_target_ids=) }
36
36
  end
37
37
 
38
+ context "A class including Tenacity with no associations" do
39
+ should "be able to be saved successfully" do
40
+ object = NoAssociations.new(:name => "Daniel")
41
+ assert object.save
42
+ end
43
+ end
44
+
38
45
  context "The object returned by a has_many association" do
39
46
  setup do
40
47
  setup_fixtures
@@ -6,12 +6,16 @@ class ActiveRecordHasManyTarget < ActiveRecord::Base
6
6
  t_belongs_to :data_mapper_object
7
7
  t_belongs_to :mongo_mapper_object
8
8
  require_mongoid { t_belongs_to :mongoid_object }
9
+ require_ripple { t_belongs_to :ripple_object }
9
10
  t_belongs_to :sequel_object
11
+ require_toystore { t_belongs_to :toystore_object }
10
12
 
11
13
  t_belongs_to :active_record_has_many_target_testable, :polymorphic => true
12
14
  t_belongs_to :couch_rest_has_many_target_testable, :polymorphic => true
13
15
  t_belongs_to :data_mapper_has_many_target_testable, :polymorphic => true
14
16
  t_belongs_to :mongo_mapper_has_many_target_testable, :polymorphic => true
15
17
  require_mongoid { t_belongs_to :mongoid_has_many_target_testable, :polymorphic => true }
18
+ require_ripple { t_belongs_to :ripple_has_many_target_testable, :polymorphic => true }
16
19
  t_belongs_to :sequel_has_many_target_testable, :polymorphic => true
20
+ require_toystore { t_belongs_to :toystore_has_many_target_testable, :polymorphic => true }
17
21
  end
@@ -6,12 +6,16 @@ class ActiveRecordHasOneTarget < ActiveRecord::Base
6
6
  t_belongs_to :data_mapper_object
7
7
  t_belongs_to :mongo_mapper_object
8
8
  require_mongoid { t_belongs_to :mongoid_object }
9
+ require_ripple { t_belongs_to :ripple_object }
9
10
  t_belongs_to :sequel_object
11
+ require_toystore { t_belongs_to :toystore_object }
10
12
 
11
13
  t_belongs_to :active_record_has_one_target_testable, :polymorphic => true
12
14
  t_belongs_to :couch_rest_has_one_target_testable, :polymorphic => true
13
15
  t_belongs_to :data_mapper_has_one_target_testable, :polymorphic => true
14
16
  t_belongs_to :mongo_mapper_has_one_target_testable, :polymorphic => true
15
17
  require_mongoid { t_belongs_to :mongoid_has_one_target_testable, :polymorphic => true }
18
+ require_ripple { t_belongs_to :ripple_has_one_target_testable, :polymorphic => true }
16
19
  t_belongs_to :sequel_has_one_target_testable, :polymorphic => true
20
+ require_toystore { t_belongs_to :toystore_has_one_target_testable, :polymorphic => true }
17
21
  end
@@ -6,28 +6,36 @@ class ActiveRecordObject < ActiveRecord::Base
6
6
  t_has_one :data_mapper_has_one_target
7
7
  t_has_one :mongo_mapper_has_one_target
8
8
  require_mongoid { t_has_one :mongoid_has_one_target }
9
+ require_ripple { t_has_one :ripple_has_one_target }
9
10
  t_has_one :sequel_has_one_target
11
+ require_toystore { t_has_one :toystore_has_one_target }
10
12
 
11
13
  t_has_one :active_record_has_one_target, :as => :active_record_has_one_target_testable
12
14
  t_has_one :couch_rest_has_one_target, :as => :couch_rest_has_one_target_testable
13
15
  t_has_one :data_mapper_has_one_target, :as => :data_mapper_has_one_target_testable
14
16
  t_has_one :mongo_mapper_has_one_target, :as => :mongo_mapper_has_one_target_testable
15
17
  require_mongoid { t_has_one :mongoid_has_one_target, :as => :mongoid_has_one_target_testable }
18
+ require_ripple { t_has_one :ripple_has_one_target, :as => :ripple_has_one_target_testable }
16
19
  t_has_one :sequel_has_one_target, :as => :sequel_has_one_target_testable
20
+ require_toystore { t_has_one :toystore_has_one_target, :as => :toystore_has_one_target_testable }
17
21
 
18
22
  t_has_many :active_record_has_many_targets
19
23
  t_has_many :couch_rest_has_many_targets
20
24
  t_has_many :data_mapper_has_many_targets
21
25
  t_has_many :mongo_mapper_has_many_targets
22
26
  require_mongoid { t_has_many :mongoid_has_many_targets }
27
+ require_ripple { t_has_many :ripple_has_many_targets }
23
28
  t_has_many :sequel_has_many_targets
29
+ require_toystore { t_has_many :toystore_has_many_targets }
24
30
 
25
31
  t_has_many :active_record_has_many_targets, :as => :active_record_has_many_target_testable
26
32
  t_has_many :couch_rest_has_many_targets, :as => :couch_rest_has_many_target_testable
27
33
  t_has_many :data_mapper_has_many_targets, :as => :data_mapper_has_many_target_testable
28
34
  t_has_many :mongo_mapper_has_many_targets, :as => :mongo_mapper_has_many_target_testable
29
35
  require_mongoid { t_has_many :mongoid_has_many_targets, :as => :mongoid_has_many_target_testable }
36
+ require_ripple { t_has_many :ripple_has_many_targets, :as => :ripple_has_many_target_testable }
30
37
  t_has_many :sequel_has_many_targets, :as => :sequel_has_many_target_testable
38
+ require_toystore { t_has_many :toystore_has_many_targets, :as => :toystore_has_many_target_testable }
31
39
 
32
40
  t_has_one :mongo_mapper_autosave_true_has_one_target, :autosave => true
33
41
  t_has_one :mongo_mapper_autosave_false_has_one_target, :autosave => false
@@ -7,13 +7,17 @@ class CouchRestHasManyTarget < CouchRest::Model::Base
7
7
  t_belongs_to :data_mapper_object
8
8
  t_belongs_to :mongo_mapper_object
9
9
  require_mongoid { t_belongs_to :mongoid_object }
10
+ require_ripple { t_belongs_to :ripple_object }
10
11
  t_belongs_to :sequel_object
12
+ require_toystore { t_belongs_to :toystore_object }
11
13
 
12
14
  t_belongs_to :active_record_has_many_target_testable, :polymorphic => true
13
15
  t_belongs_to :couch_rest_has_many_target_testable, :polymorphic => true
14
16
  t_belongs_to :data_mapper_has_many_target_testable, :polymorphic => true
15
17
  t_belongs_to :mongo_mapper_has_many_target_testable, :polymorphic => true
16
18
  require_mongoid { t_belongs_to :mongoid_has_many_target_testable, :polymorphic => true }
19
+ require_ripple { t_belongs_to :ripple_has_many_target_testable, :polymorphic => true }
17
20
  t_belongs_to :sequel_has_many_target_testable, :polymorphic => true
21
+ require_toystore { t_belongs_to :toystore_has_many_target_testable, :polymorphic => true }
18
22
  end
19
23