stonegao-mongoid 2.0.0.rc.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (199) hide show
  1. data/LICENSE +20 -0
  2. data/README.rdoc +50 -0
  3. data/Rakefile +51 -0
  4. data/lib/config/locales/bg.yml +44 -0
  5. data/lib/config/locales/de.yml +44 -0
  6. data/lib/config/locales/en.yml +45 -0
  7. data/lib/config/locales/es.yml +44 -0
  8. data/lib/config/locales/fr.yml +45 -0
  9. data/lib/config/locales/hu.yml +47 -0
  10. data/lib/config/locales/it.yml +42 -0
  11. data/lib/config/locales/kr.yml +68 -0
  12. data/lib/config/locales/nl.yml +42 -0
  13. data/lib/config/locales/pl.yml +42 -0
  14. data/lib/config/locales/pt-br.yml +43 -0
  15. data/lib/config/locales/pt.yml +43 -0
  16. data/lib/config/locales/ro.yml +49 -0
  17. data/lib/config/locales/sv.yml +43 -0
  18. data/lib/config/locales/zh-CN.yml +34 -0
  19. data/lib/mongoid/atomicity.rb +111 -0
  20. data/lib/mongoid/attributes.rb +251 -0
  21. data/lib/mongoid/callbacks.rb +13 -0
  22. data/lib/mongoid/collection.rb +137 -0
  23. data/lib/mongoid/collections/cyclic_iterator.rb +34 -0
  24. data/lib/mongoid/collections/master.rb +29 -0
  25. data/lib/mongoid/collections/operations.rb +42 -0
  26. data/lib/mongoid/collections/slaves.rb +45 -0
  27. data/lib/mongoid/collections.rb +70 -0
  28. data/lib/mongoid/components.rb +45 -0
  29. data/lib/mongoid/config/database.rb +167 -0
  30. data/lib/mongoid/config/replset_database.rb +48 -0
  31. data/lib/mongoid/config.rb +343 -0
  32. data/lib/mongoid/contexts/enumerable/sort.rb +43 -0
  33. data/lib/mongoid/contexts/enumerable.rb +226 -0
  34. data/lib/mongoid/contexts/ids.rb +25 -0
  35. data/lib/mongoid/contexts/mongo.rb +345 -0
  36. data/lib/mongoid/contexts/paging.rb +50 -0
  37. data/lib/mongoid/contexts.rb +21 -0
  38. data/lib/mongoid/copyable.rb +44 -0
  39. data/lib/mongoid/criteria.rb +325 -0
  40. data/lib/mongoid/criterion/complex.rb +34 -0
  41. data/lib/mongoid/criterion/creational.rb +34 -0
  42. data/lib/mongoid/criterion/exclusion.rb +67 -0
  43. data/lib/mongoid/criterion/inclusion.rb +134 -0
  44. data/lib/mongoid/criterion/inspection.rb +20 -0
  45. data/lib/mongoid/criterion/optional.rb +213 -0
  46. data/lib/mongoid/criterion/selector.rb +74 -0
  47. data/lib/mongoid/cursor.rb +81 -0
  48. data/lib/mongoid/default_scope.rb +28 -0
  49. data/lib/mongoid/dirty.rb +251 -0
  50. data/lib/mongoid/document.rb +256 -0
  51. data/lib/mongoid/errors/document_not_found.rb +29 -0
  52. data/lib/mongoid/errors/invalid_collection.rb +19 -0
  53. data/lib/mongoid/errors/invalid_database.rb +20 -0
  54. data/lib/mongoid/errors/invalid_field.rb +19 -0
  55. data/lib/mongoid/errors/invalid_options.rb +16 -0
  56. data/lib/mongoid/errors/invalid_type.rb +26 -0
  57. data/lib/mongoid/errors/mongoid_error.rb +27 -0
  58. data/lib/mongoid/errors/too_many_nested_attribute_records.rb +21 -0
  59. data/lib/mongoid/errors/unsaved_document.rb +23 -0
  60. data/lib/mongoid/errors/unsupported_version.rb +21 -0
  61. data/lib/mongoid/errors/validations.rb +24 -0
  62. data/lib/mongoid/errors.rb +12 -0
  63. data/lib/mongoid/extensions/array/conversions.rb +23 -0
  64. data/lib/mongoid/extensions/array/parentization.rb +13 -0
  65. data/lib/mongoid/extensions/big_decimal/conversions.rb +19 -0
  66. data/lib/mongoid/extensions/binary/conversions.rb +17 -0
  67. data/lib/mongoid/extensions/boolean/conversions.rb +27 -0
  68. data/lib/mongoid/extensions/date/conversions.rb +25 -0
  69. data/lib/mongoid/extensions/datetime/conversions.rb +12 -0
  70. data/lib/mongoid/extensions/false_class/equality.rb +13 -0
  71. data/lib/mongoid/extensions/float/conversions.rb +20 -0
  72. data/lib/mongoid/extensions/hash/conversions.rb +19 -0
  73. data/lib/mongoid/extensions/hash/criteria_helpers.rb +22 -0
  74. data/lib/mongoid/extensions/hash/scoping.rb +12 -0
  75. data/lib/mongoid/extensions/integer/conversions.rb +20 -0
  76. data/lib/mongoid/extensions/nil/collectionization.rb +12 -0
  77. data/lib/mongoid/extensions/object/conversions.rb +25 -0
  78. data/lib/mongoid/extensions/object/reflections.rb +17 -0
  79. data/lib/mongoid/extensions/object/yoda.rb +27 -0
  80. data/lib/mongoid/extensions/object_id/conversions.rb +57 -0
  81. data/lib/mongoid/extensions/proc/scoping.rb +12 -0
  82. data/lib/mongoid/extensions/set/conversions.rb +20 -0
  83. data/lib/mongoid/extensions/string/conversions.rb +34 -0
  84. data/lib/mongoid/extensions/string/inflections.rb +97 -0
  85. data/lib/mongoid/extensions/symbol/conversions.rb +21 -0
  86. data/lib/mongoid/extensions/symbol/inflections.rb +40 -0
  87. data/lib/mongoid/extensions/time_conversions.rb +38 -0
  88. data/lib/mongoid/extensions/true_class/equality.rb +13 -0
  89. data/lib/mongoid/extensions.rb +116 -0
  90. data/lib/mongoid/extras.rb +61 -0
  91. data/lib/mongoid/factory.rb +20 -0
  92. data/lib/mongoid/field.rb +95 -0
  93. data/lib/mongoid/fields.rb +138 -0
  94. data/lib/mongoid/finders.rb +173 -0
  95. data/lib/mongoid/hierarchy.rb +85 -0
  96. data/lib/mongoid/identity.rb +89 -0
  97. data/lib/mongoid/indexes.rb +38 -0
  98. data/lib/mongoid/inspection.rb +58 -0
  99. data/lib/mongoid/javascript/functions.yml +37 -0
  100. data/lib/mongoid/javascript.rb +21 -0
  101. data/lib/mongoid/json.rb +16 -0
  102. data/lib/mongoid/keys.rb +77 -0
  103. data/lib/mongoid/logger.rb +18 -0
  104. data/lib/mongoid/matchers/all.rb +11 -0
  105. data/lib/mongoid/matchers/default.rb +27 -0
  106. data/lib/mongoid/matchers/exists.rb +13 -0
  107. data/lib/mongoid/matchers/gt.rb +11 -0
  108. data/lib/mongoid/matchers/gte.rb +11 -0
  109. data/lib/mongoid/matchers/in.rb +11 -0
  110. data/lib/mongoid/matchers/lt.rb +11 -0
  111. data/lib/mongoid/matchers/lte.rb +11 -0
  112. data/lib/mongoid/matchers/ne.rb +11 -0
  113. data/lib/mongoid/matchers/nin.rb +11 -0
  114. data/lib/mongoid/matchers/size.rb +11 -0
  115. data/lib/mongoid/matchers.rb +55 -0
  116. data/lib/mongoid/modifiers/command.rb +18 -0
  117. data/lib/mongoid/modifiers/inc.rb +24 -0
  118. data/lib/mongoid/modifiers.rb +24 -0
  119. data/lib/mongoid/multi_database.rb +11 -0
  120. data/lib/mongoid/multi_parameter_attributes.rb +80 -0
  121. data/lib/mongoid/named_scope.rb +36 -0
  122. data/lib/mongoid/nested_attributes.rb +43 -0
  123. data/lib/mongoid/paranoia.rb +103 -0
  124. data/lib/mongoid/paths.rb +61 -0
  125. data/lib/mongoid/persistence/command.rb +59 -0
  126. data/lib/mongoid/persistence/insert.rb +53 -0
  127. data/lib/mongoid/persistence/insert_embedded.rb +42 -0
  128. data/lib/mongoid/persistence/remove.rb +44 -0
  129. data/lib/mongoid/persistence/remove_all.rb +40 -0
  130. data/lib/mongoid/persistence/remove_embedded.rb +48 -0
  131. data/lib/mongoid/persistence/update.rb +76 -0
  132. data/lib/mongoid/persistence.rb +237 -0
  133. data/lib/mongoid/railtie.rb +129 -0
  134. data/lib/mongoid/railties/database.rake +171 -0
  135. data/lib/mongoid/railties/document.rb +12 -0
  136. data/lib/mongoid/relations/accessors.rb +157 -0
  137. data/lib/mongoid/relations/auto_save.rb +34 -0
  138. data/lib/mongoid/relations/binding.rb +26 -0
  139. data/lib/mongoid/relations/bindings/embedded/in.rb +82 -0
  140. data/lib/mongoid/relations/bindings/embedded/many.rb +98 -0
  141. data/lib/mongoid/relations/bindings/embedded/one.rb +66 -0
  142. data/lib/mongoid/relations/bindings/referenced/in.rb +74 -0
  143. data/lib/mongoid/relations/bindings/referenced/many.rb +96 -0
  144. data/lib/mongoid/relations/bindings/referenced/many_to_many.rb +99 -0
  145. data/lib/mongoid/relations/bindings/referenced/one.rb +66 -0
  146. data/lib/mongoid/relations/bindings.rb +9 -0
  147. data/lib/mongoid/relations/builder.rb +42 -0
  148. data/lib/mongoid/relations/builders/embedded/in.rb +25 -0
  149. data/lib/mongoid/relations/builders/embedded/many.rb +32 -0
  150. data/lib/mongoid/relations/builders/embedded/one.rb +26 -0
  151. data/lib/mongoid/relations/builders/nested_attributes/many.rb +116 -0
  152. data/lib/mongoid/relations/builders/nested_attributes/one.rb +135 -0
  153. data/lib/mongoid/relations/builders/referenced/in.rb +32 -0
  154. data/lib/mongoid/relations/builders/referenced/many.rb +26 -0
  155. data/lib/mongoid/relations/builders/referenced/many_to_many.rb +29 -0
  156. data/lib/mongoid/relations/builders/referenced/one.rb +30 -0
  157. data/lib/mongoid/relations/builders.rb +79 -0
  158. data/lib/mongoid/relations/cascading/delete.rb +19 -0
  159. data/lib/mongoid/relations/cascading/destroy.rb +19 -0
  160. data/lib/mongoid/relations/cascading/nullify.rb +18 -0
  161. data/lib/mongoid/relations/cascading/strategy.rb +26 -0
  162. data/lib/mongoid/relations/cascading.rb +55 -0
  163. data/lib/mongoid/relations/constraint.rb +45 -0
  164. data/lib/mongoid/relations/cyclic.rb +97 -0
  165. data/lib/mongoid/relations/embedded/in.rb +173 -0
  166. data/lib/mongoid/relations/embedded/many.rb +483 -0
  167. data/lib/mongoid/relations/embedded/one.rb +170 -0
  168. data/lib/mongoid/relations/macros.rb +306 -0
  169. data/lib/mongoid/relations/many.rb +171 -0
  170. data/lib/mongoid/relations/metadata.rb +533 -0
  171. data/lib/mongoid/relations/nested_builder.rb +68 -0
  172. data/lib/mongoid/relations/one.rb +47 -0
  173. data/lib/mongoid/relations/polymorphic.rb +54 -0
  174. data/lib/mongoid/relations/proxy.rb +128 -0
  175. data/lib/mongoid/relations/referenced/in.rb +216 -0
  176. data/lib/mongoid/relations/referenced/many.rb +443 -0
  177. data/lib/mongoid/relations/referenced/many_to_many.rb +344 -0
  178. data/lib/mongoid/relations/referenced/one.rb +206 -0
  179. data/lib/mongoid/relations/reflections.rb +45 -0
  180. data/lib/mongoid/relations.rb +105 -0
  181. data/lib/mongoid/safe.rb +23 -0
  182. data/lib/mongoid/safety.rb +207 -0
  183. data/lib/mongoid/scope.rb +31 -0
  184. data/lib/mongoid/serialization.rb +99 -0
  185. data/lib/mongoid/state.rb +66 -0
  186. data/lib/mongoid/timestamps.rb +38 -0
  187. data/lib/mongoid/validations/associated.rb +42 -0
  188. data/lib/mongoid/validations/uniqueness.rb +85 -0
  189. data/lib/mongoid/validations.rb +117 -0
  190. data/lib/mongoid/version.rb +4 -0
  191. data/lib/mongoid/versioning.rb +51 -0
  192. data/lib/mongoid.rb +139 -0
  193. data/lib/rails/generators/mongoid/config/config_generator.rb +25 -0
  194. data/lib/rails/generators/mongoid/config/templates/mongoid.yml +23 -0
  195. data/lib/rails/generators/mongoid/model/model_generator.rb +24 -0
  196. data/lib/rails/generators/mongoid/model/templates/model.rb +17 -0
  197. data/lib/rails/generators/mongoid_generator.rb +61 -0
  198. data/lib/rails/mongoid.rb +57 -0
  199. metadata +380 -0
@@ -0,0 +1,128 @@
1
+ # encoding: utf-8
2
+ module Mongoid # :nodoc:
3
+ module Relations #:nodoc:
4
+
5
+ # This class is the superclass for all relation proxy objects, and contains
6
+ # common behaviour for all of them.
7
+ class Proxy
8
+
9
+ # We undefine most methods to get them sent through to the target.
10
+ instance_methods.each do |method|
11
+ undef_method(method) unless
12
+ method =~ /(^__|^send$|^object_id$|^extend$|^tap$)/
13
+ end
14
+
15
+ attr_accessor :base, :loaded, :metadata, :target
16
+
17
+ # Backwards compatibiloty with Mongoid beta releases.
18
+ delegate :klass, :to => :metadata
19
+
20
+ # Convenience for setting the target and the metadata properties since
21
+ # all proxies will need to do this.
22
+ #
23
+ # @example Initialize the proxy.
24
+ # proxy.init(person, name, metadata)
25
+ #
26
+ # @param [ Document ] base The base document on the proxy.
27
+ # @param [ Document, Array<Document> ] target The target of the proxy.
28
+ # @param [ Metadata ] metadata The relation's metadata.
29
+ #
30
+ # @since 2.0.0.rc.1
31
+ def init(base, target, metadata, &block)
32
+ @base, @building, @target, @metadata = base, false, target, metadata
33
+ yield block if block_given?
34
+ extend Module.new(&metadata.extension) if metadata.extension?
35
+ end
36
+
37
+ protected
38
+
39
+ # Yields to the block to allow the building flag to get set and unset for
40
+ # the supplied code.
41
+ #
42
+ # @example Set the building status.
43
+ # person.building { @target << Post.new }
44
+ #
45
+ # @since 2.0.0.rc.1
46
+ def building(&block)
47
+ @building = true
48
+ yield block if block_given?
49
+ @building = false
50
+ end
51
+
52
+ # Convenience method for determining if we are building an association.
53
+ # We never want to save in this case.
54
+ #
55
+ # @example Are we currently building?
56
+ # person.posts.building?
57
+ #
58
+ # @return [ true, false ] True if currently building, false if not.
59
+ #
60
+ # @since 2.0.0.rc.1
61
+ def building?
62
+ !!@building
63
+ end
64
+
65
+ # Return a new document for the type of class we want to instantiate.
66
+ # If the type is provided use that, otherwise the klass from the
67
+ # metadata.
68
+ #
69
+ # @example Get an instantiated document.
70
+ # proxy.instantiated(Person)
71
+ #
72
+ # @param [ Class ] type The type of class to instantiate.
73
+ #
74
+ # @return [ Document ] The freshly created document.
75
+ #
76
+ # @since 2.0.0.rc.1
77
+ def instantiated(type = nil)
78
+ type ? type.instantiate : metadata.klass.instantiate
79
+ end
80
+
81
+ # Determines if the target been loaded into memory or not.
82
+ #
83
+ # @example Is the proxy loaded?
84
+ # proxy.loaded?
85
+ #
86
+ # @return [ true, false ] True if loaded, false if not.
87
+ #
88
+ # @since 2.0.0.rc.1
89
+ def loaded?
90
+ !!@loaded
91
+ end
92
+
93
+ # Takes the supplied documents and sets the metadata on them. Used when
94
+ # creating new documents and adding them to the relation.
95
+ #
96
+ # @example Set the metadata.
97
+ # proxy.characterize(addresses)
98
+ #
99
+ # @param [ Array<Document> ] documents The documents to set metadata on.
100
+ #
101
+ # @since 2.0.0.rc.4
102
+ def characterize(documents)
103
+ documents.each { |doc| characterize_one(doc) }
104
+ end
105
+
106
+ # Takes the supplied document and sets the metadata on it.
107
+ #
108
+ # @example Set the metadata.
109
+ # proxt.characterize_one(name)
110
+ #
111
+ # @param [ Document ] document The document to set on.
112
+ #
113
+ # @since 2.0.0.rc.4
114
+ def characterize_one(document)
115
+ document.metadata = metadata unless document.metadata
116
+ end
117
+
118
+ # Default behavior of method missing should be to delegate all calls
119
+ # to the target of the proxy. This can be overridden in special cases.
120
+ #
121
+ # @param [ String, Symbol ] name The name of the method.
122
+ # @param [ Array ] *args The arguments passed to the method.
123
+ def method_missing(name, *args, &block)
124
+ target.send(name, *args, &block)
125
+ end
126
+ end
127
+ end
128
+ end
@@ -0,0 +1,216 @@
1
+ # encoding: utf-8
2
+ module Mongoid # :nodoc:
3
+ module Relations #:nodoc:
4
+ module Referenced #:nodoc:
5
+
6
+ # This class handles all behaviour for relations that are either
7
+ # one-to-many or one-to-one, where the foreign key is store on this side
8
+ # of the relation and the reference is to document(s) in another
9
+ # collection.
10
+ class In < Relations::One
11
+
12
+ # Binds the base object to the inverse of the relation. This is so we
13
+ # are referenced to the actual objects themselves and dont hit the
14
+ # database twice when setting the relations up.
15
+ #
16
+ # This is called after first creating the relation, or if a new object
17
+ # is set on the relation.
18
+ #
19
+ # @example Bind the relation.
20
+ # game.person.bind
21
+ #
22
+ # @param [ Hash ] options The options to bind with.
23
+ #
24
+ # @option options [ true, false ] :binding Are we in build mode?
25
+ # @option options [ true, false ] :continue Continue binding the
26
+ # inverse?
27
+ #
28
+ # @since 2.0.0.rc.1
29
+ def bind(options = {})
30
+ binding.bind(options)
31
+ end
32
+
33
+ # Instantiate a new referenced_in relation.
34
+ #
35
+ # @example Create the new relation.
36
+ # Referenced::In.new(game, person, metadata)
37
+ #
38
+ # @param [ Document ] base The document this relation hangs off of.
39
+ # @param [ Document, Array<Document> ] target The target (parent) of the
40
+ # relation.
41
+ # @param [ Metadata ] metadata The relation's metadata.
42
+ def initialize(base, target, metadata)
43
+ init(base, target, metadata) do
44
+ characterize_one(target)
45
+ end
46
+ end
47
+
48
+ # Substitutes the supplied target documents for the existing document
49
+ # in the relation.
50
+ #
51
+ # @example Substitute the relation.
52
+ # name.substitute(new_name)
53
+ #
54
+ # @param [ Document, Array<Document> ] new_target The replacement.
55
+ # @param [ true, false ] building Are we in build mode?
56
+ #
57
+ # @return [ In, nil ] The relation or nil.
58
+ #
59
+ # @since 2.0.0.rc.1
60
+ def substitute(new_target, options = {})
61
+ old_target = target
62
+ tap do |relation|
63
+ relation.target = new_target
64
+ if new_target
65
+ bind(options)
66
+ else
67
+ unbind(old_target, options)
68
+ nil
69
+ end
70
+ end
71
+ end
72
+
73
+ # Unbinds the base object to the inverse of the relation. This occurs
74
+ # when setting a side of the relation to nil.
75
+ #
76
+ # @example Unbind the relation.
77
+ # game.person.unbind
78
+ #
79
+ # @param [ Document, Array<Document> ] old_target The previous target.
80
+ # @param [ Hash ] options The options to bind with.
81
+ #
82
+ # @option options [ true, false ] :binding Are we in build mode?
83
+ # @option options [ true, false ] :continue Continue binding the
84
+ # inverse?
85
+ #
86
+ # @since 2.0.0.rc.1
87
+ def unbind(old_target, options = {})
88
+ binding(old_target).unbind(options)
89
+ end
90
+
91
+ private
92
+
93
+ # Instantiate the binding associated with this relation.
94
+ #
95
+ # @example Get the binding object.
96
+ # binding([ address ])
97
+ #
98
+ # @param [ Document, Array<Document> ] new_target The replacement.
99
+ #
100
+ # @return [ Binding ] The binding object.
101
+ #
102
+ # @since 2.0.0.rc.1
103
+ def binding(new_target = nil)
104
+ Bindings::Referenced::In.new(base, new_target || target, metadata)
105
+ end
106
+
107
+ class << self
108
+
109
+ # Return the builder that is responsible for generating the documents
110
+ # that will be used by this relation.
111
+ #
112
+ # @example Get the builder.
113
+ # Referenced::In.builder(meta, object)
114
+ #
115
+ # @param [ Metadata ] meta The metadata of the relation.
116
+ # @param [ Document, Hash ] object A document or attributes to build
117
+ # with.
118
+ #
119
+ # @return [ Builder ] A new builder object.
120
+ #
121
+ # @since 2.0.0.rc.1
122
+ def builder(meta, object)
123
+ Builders::Referenced::In.new(meta, object)
124
+ end
125
+
126
+ # Returns true if the relation is an embedded one. In this case
127
+ # always false.
128
+ #
129
+ # @example Is this relation embedded?
130
+ # Referenced::In.embedded?
131
+ #
132
+ # @return [ false ] Always false.
133
+ #
134
+ # @since 2.0.0.rc.1
135
+ def embedded?
136
+ false
137
+ end
138
+
139
+ # Get the default value for the foreign key.
140
+ #
141
+ # @example Get the default.
142
+ # Referenced::In.foreign_key_default
143
+ #
144
+ # @return [ nil ] Always nil.
145
+ #
146
+ # @since 2.0.0.rc.1
147
+ def foreign_key_default
148
+ nil
149
+ end
150
+
151
+ # Returns the suffix of the foreign key field, either "_id" or "_ids".
152
+ #
153
+ # @example Get the suffix for the foreign key.
154
+ # Referenced::In.foreign_key_suffix
155
+ #
156
+ # @return [ String ] "_id"
157
+ #
158
+ # @since 2.0.0.rc.1
159
+ def foreign_key_suffix
160
+ "_id"
161
+ end
162
+
163
+ # Returns the macro for this relation. Used mostly as a helper in
164
+ # reflection.
165
+ #
166
+ # @example Get the macro.
167
+ # Referenced::In.macro
168
+ #
169
+ # @return [ Symbol ] :referenced_in
170
+ def macro
171
+ :referenced_in
172
+ end
173
+
174
+ # Return the nested builder that is responsible for generating the documents
175
+ # that will be used by this relation.
176
+ #
177
+ # @example Get the nested builder.
178
+ # Referenced::In.builder(attributes, options)
179
+ #
180
+ # @param [ Metadata ] metadata The relation metadata.
181
+ # @param [ Hash ] attributes The attributes to build with.
182
+ # @param [ Hash ] options The options for the builder.
183
+ #
184
+ # @option options [ true, false ] :allow_destroy Can documents be
185
+ # deleted?
186
+ # @option options [ Integer ] :limit Max number of documents to
187
+ # create at once.
188
+ # @option options [ Proc, Symbol ] :reject_if If documents match this
189
+ # option then they are ignored.
190
+ # @option options [ true, false ] :update_only Only existing documents
191
+ # can be modified.
192
+ #
193
+ # @return [ NestedBuilder ] A newly instantiated nested builder object.
194
+ #
195
+ # @since 2.0.0.rc.1
196
+ def nested_builder(metadata, attributes, options)
197
+ Builders::NestedAttributes::One.new(metadata, attributes, options)
198
+ end
199
+
200
+ # Tells the caller if this relation is one that stores the foreign
201
+ # key on its own objects.
202
+ #
203
+ # @example Does this relation store a foreign key?
204
+ # Referenced::In.stores_foreign_key?
205
+ #
206
+ # @return [ true ] Always true.
207
+ #
208
+ # @since 2.0.0.rc.1
209
+ def stores_foreign_key?
210
+ true
211
+ end
212
+ end
213
+ end
214
+ end
215
+ end
216
+ end