mongoid 2.0.0.beta.20 → 2.0.0.rc.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (134) hide show
  1. data/README.rdoc +8 -0
  2. data/Rakefile +51 -0
  3. data/lib/config/locales/nl.yml +39 -0
  4. data/lib/config/locales/ro.yml +1 -1
  5. data/lib/mongoid.rb +17 -17
  6. data/lib/mongoid/atomicity.rb +54 -22
  7. data/lib/mongoid/attributes.rb +145 -125
  8. data/lib/mongoid/callbacks.rb +7 -2
  9. data/lib/mongoid/collection.rb +49 -32
  10. data/lib/mongoid/collections.rb +0 -1
  11. data/lib/mongoid/components.rb +34 -29
  12. data/lib/mongoid/config.rb +207 -193
  13. data/lib/mongoid/config/database.rb +167 -0
  14. data/lib/mongoid/contexts.rb +2 -5
  15. data/lib/mongoid/contexts/enumerable.rb +30 -4
  16. data/lib/mongoid/contexts/ids.rb +2 -2
  17. data/lib/mongoid/contexts/mongo.rb +30 -5
  18. data/lib/mongoid/copyable.rb +44 -0
  19. data/lib/mongoid/criteria.rb +110 -56
  20. data/lib/mongoid/criterion/creational.rb +34 -0
  21. data/lib/mongoid/criterion/destructive.rb +37 -0
  22. data/lib/mongoid/criterion/exclusion.rb +3 -1
  23. data/lib/mongoid/criterion/inclusion.rb +59 -64
  24. data/lib/mongoid/criterion/inspection.rb +22 -0
  25. data/lib/mongoid/criterion/optional.rb +42 -54
  26. data/lib/mongoid/criterion/selector.rb +9 -0
  27. data/lib/mongoid/default_scope.rb +28 -0
  28. data/lib/mongoid/deprecation.rb +5 -5
  29. data/lib/mongoid/dirty.rb +4 -5
  30. data/lib/mongoid/document.rb +161 -114
  31. data/lib/mongoid/extensions.rb +7 -11
  32. data/lib/mongoid/extensions/array/parentization.rb +2 -2
  33. data/lib/mongoid/extensions/date/conversions.rb +1 -1
  34. data/lib/mongoid/extensions/hash/conversions.rb +0 -23
  35. data/lib/mongoid/extensions/nil/collectionization.rb +12 -0
  36. data/lib/mongoid/extensions/object/reflections.rb +17 -0
  37. data/lib/mongoid/extensions/object/yoda.rb +27 -0
  38. data/lib/mongoid/extensions/string/conversions.rb +23 -4
  39. data/lib/mongoid/extensions/time_conversions.rb +4 -4
  40. data/lib/mongoid/field.rb +30 -19
  41. data/lib/mongoid/fields.rb +15 -5
  42. data/lib/mongoid/finders.rb +19 -11
  43. data/lib/mongoid/hierarchy.rb +34 -28
  44. data/lib/mongoid/identity.rb +62 -20
  45. data/lib/mongoid/inspection.rb +58 -0
  46. data/lib/mongoid/matchers.rb +20 -0
  47. data/lib/mongoid/multi_database.rb +11 -0
  48. data/lib/mongoid/nested_attributes.rb +41 -0
  49. data/lib/mongoid/paranoia.rb +3 -4
  50. data/lib/mongoid/paths.rb +1 -1
  51. data/lib/mongoid/persistence.rb +89 -90
  52. data/lib/mongoid/persistence/command.rb +20 -4
  53. data/lib/mongoid/persistence/insert.rb +13 -11
  54. data/lib/mongoid/persistence/insert_embedded.rb +8 -6
  55. data/lib/mongoid/persistence/remove.rb +6 -4
  56. data/lib/mongoid/persistence/remove_all.rb +6 -4
  57. data/lib/mongoid/persistence/remove_embedded.rb +8 -6
  58. data/lib/mongoid/persistence/update.rb +12 -10
  59. data/lib/mongoid/railtie.rb +2 -2
  60. data/lib/mongoid/railties/database.rake +10 -9
  61. data/lib/mongoid/relations.rb +104 -0
  62. data/lib/mongoid/relations/accessors.rb +154 -0
  63. data/lib/mongoid/relations/auto_save.rb +34 -0
  64. data/lib/mongoid/relations/binding.rb +24 -0
  65. data/lib/mongoid/relations/bindings.rb +9 -0
  66. data/lib/mongoid/relations/bindings/embedded/in.rb +77 -0
  67. data/lib/mongoid/relations/bindings/embedded/many.rb +93 -0
  68. data/lib/mongoid/relations/bindings/embedded/one.rb +65 -0
  69. data/lib/mongoid/relations/bindings/referenced/in.rb +78 -0
  70. data/lib/mongoid/relations/bindings/referenced/many.rb +93 -0
  71. data/lib/mongoid/relations/bindings/referenced/many_to_many.rb +94 -0
  72. data/lib/mongoid/relations/bindings/referenced/one.rb +63 -0
  73. data/lib/mongoid/relations/builder.rb +41 -0
  74. data/lib/mongoid/relations/builders.rb +79 -0
  75. data/lib/mongoid/relations/builders/embedded/in.rb +25 -0
  76. data/lib/mongoid/relations/builders/embedded/many.rb +32 -0
  77. data/lib/mongoid/relations/builders/embedded/one.rb +26 -0
  78. data/lib/mongoid/relations/builders/nested_attributes/many.rb +116 -0
  79. data/lib/mongoid/relations/builders/nested_attributes/one.rb +135 -0
  80. data/lib/mongoid/relations/builders/referenced/in.rb +32 -0
  81. data/lib/mongoid/relations/builders/referenced/many.rb +26 -0
  82. data/lib/mongoid/relations/builders/referenced/many_to_many.rb +29 -0
  83. data/lib/mongoid/relations/builders/referenced/one.rb +30 -0
  84. data/lib/mongoid/relations/cascading.rb +55 -0
  85. data/lib/mongoid/relations/cascading/delete.rb +19 -0
  86. data/lib/mongoid/relations/cascading/destroy.rb +19 -0
  87. data/lib/mongoid/relations/cascading/nullify.rb +18 -0
  88. data/lib/mongoid/relations/cascading/strategy.rb +26 -0
  89. data/lib/mongoid/relations/cyclic.rb +97 -0
  90. data/lib/mongoid/relations/embedded/in.rb +172 -0
  91. data/lib/mongoid/relations/embedded/many.rb +450 -0
  92. data/lib/mongoid/relations/embedded/one.rb +169 -0
  93. data/lib/mongoid/relations/macros.rb +302 -0
  94. data/lib/mongoid/relations/many.rb +185 -0
  95. data/lib/mongoid/relations/metadata.rb +529 -0
  96. data/lib/mongoid/relations/nested_builder.rb +52 -0
  97. data/lib/mongoid/relations/one.rb +29 -0
  98. data/lib/mongoid/relations/polymorphic.rb +54 -0
  99. data/lib/mongoid/relations/proxy.rb +122 -0
  100. data/lib/mongoid/relations/referenced/in.rb +214 -0
  101. data/lib/mongoid/relations/referenced/many.rb +358 -0
  102. data/lib/mongoid/relations/referenced/many_to_many.rb +379 -0
  103. data/lib/mongoid/relations/referenced/one.rb +204 -0
  104. data/lib/mongoid/relations/reflections.rb +45 -0
  105. data/lib/mongoid/safe.rb +11 -1
  106. data/lib/mongoid/safety.rb +122 -97
  107. data/lib/mongoid/scope.rb +14 -9
  108. data/lib/mongoid/state.rb +37 -3
  109. data/lib/mongoid/timestamps.rb +11 -0
  110. data/lib/mongoid/validations.rb +42 -3
  111. data/lib/mongoid/validations/associated.rb +8 -5
  112. data/lib/mongoid/validations/uniqueness.rb +23 -2
  113. data/lib/mongoid/version.rb +1 -1
  114. data/lib/mongoid/versioning.rb +25 -16
  115. data/lib/rails/generators/mongoid/model/templates/model.rb +3 -1
  116. metadata +95 -80
  117. data/lib/mongoid/associations.rb +0 -364
  118. data/lib/mongoid/associations/embedded_in.rb +0 -74
  119. data/lib/mongoid/associations/embeds_many.rb +0 -299
  120. data/lib/mongoid/associations/embeds_one.rb +0 -111
  121. data/lib/mongoid/associations/foreign_key.rb +0 -35
  122. data/lib/mongoid/associations/meta_data.rb +0 -38
  123. data/lib/mongoid/associations/options.rb +0 -78
  124. data/lib/mongoid/associations/proxy.rb +0 -60
  125. data/lib/mongoid/associations/referenced_in.rb +0 -70
  126. data/lib/mongoid/associations/references_many.rb +0 -254
  127. data/lib/mongoid/associations/references_many_as_array.rb +0 -128
  128. data/lib/mongoid/associations/references_one.rb +0 -104
  129. data/lib/mongoid/extensions/array/accessors.rb +0 -17
  130. data/lib/mongoid/extensions/array/assimilation.rb +0 -26
  131. data/lib/mongoid/extensions/hash/accessors.rb +0 -42
  132. data/lib/mongoid/extensions/hash/assimilation.rb +0 -40
  133. data/lib/mongoid/extensions/nil/assimilation.rb +0 -17
  134. data/lib/mongoid/memoization.rb +0 -33
@@ -0,0 +1,52 @@
1
+ # encoding: utf-8
2
+ module Mongoid # :nodoc:
3
+ module Relations #:nodoc:
4
+
5
+ # This is the superclass for builders that are in charge of handling
6
+ # creation, deletion, and updates of documents through that ever so lovely
7
+ # #accepts_nested_attributes_for.
8
+ class NestedBuilder
9
+ attr_accessor :attributes, :existing, :metadata, :options
10
+
11
+ # Determines if destroys are allowed for this document.
12
+ #
13
+ # @example Do we allow a destroy?
14
+ # builder.allow_destroy?
15
+ #
16
+ # @return [ true, false ] True if the allow destroy option was set.
17
+ #
18
+ # @since 2.0.0.rc.1
19
+ def allow_destroy?
20
+ options[:allow_destroy] || false
21
+ end
22
+
23
+ # Returns the reject if option defined with the macro.
24
+ #
25
+ # @example Is there a reject proc?
26
+ # builder.reject?
27
+ #
28
+ # @param [ Hash ] attrs The attributes to check for rejection.
29
+ #
30
+ # @return [ true, false ] True and call proc if rejectable, false if not.
31
+ #
32
+ # @since 2.0.0.rc.1
33
+ def reject?(attrs)
34
+ criteria = options[:reject_if]
35
+ criteria ? criteria.call(attrs) : false
36
+ end
37
+
38
+ # Determines if only updates can occur. Only valid for one-to-one
39
+ # relations.
40
+ #
41
+ # @example Is this update only?
42
+ # builder.update_only?
43
+ #
44
+ # @return [ true, false ] True if the update_only option was set.
45
+ #
46
+ # @since 2.0.0.rc.1
47
+ def update_only?
48
+ options[:update_only] || false
49
+ end
50
+ end
51
+ end
52
+ end
@@ -0,0 +1,29 @@
1
+ # encoding: utf-8
2
+ module Mongoid # :nodoc:
3
+ module Relations #:nodoc:
4
+
5
+ # This is the superclass for one to one relations and defines the common
6
+ # behaviour or those proxies.
7
+ class One < Proxy
8
+
9
+ # Substitutes the supplied target documents for the existing document
10
+ # in the relation.
11
+ #
12
+ # @example Substitute the new document.
13
+ # person.name.substitute(new_name)
14
+ #
15
+ # @param [ Document ] other A document to replace the target.
16
+ #
17
+ # @return [ Document, nil ] The relation or nil.
18
+ #
19
+ # @since 2.0.0.rc.1
20
+ def substitute(new_target, options = {})
21
+ old_target = target
22
+ tap do |relation|
23
+ relation.target = new_target
24
+ new_target ? bind(options) : (unbind(old_target, options) and return nil)
25
+ end
26
+ end
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,54 @@
1
+ # encoding: utf-8
2
+ module Mongoid # :nodoc:
3
+ module Relations #:nodoc:
4
+
5
+ # This module contains the behaviour for handling polymorphic relational
6
+ # associations.
7
+ module Polymorphic
8
+ extend ActiveSupport::Concern
9
+
10
+ included do
11
+ class_inheritable_accessor :polymorphic
12
+ delegate :polymorphic?, :to => "self.class"
13
+ end
14
+
15
+ module ClassMethods #:nodoc:
16
+
17
+ # Attempts to set up the information needed to handle a polymorphic
18
+ # relation, if the metadata checks out.
19
+ #
20
+ # @example Set up the polymorphic information.
21
+ # Movie.polymorph(metadata)
22
+ #
23
+ # @param [ Metadata ] metadata The relation metadata.
24
+ #
25
+ # @return [ Class ] The class being set up.
26
+ #
27
+ # @since 2.0.0.rc.1
28
+ def polymorph(metadata)
29
+ tap do |klass|
30
+ if metadata.polymorphic?
31
+ klass.polymorphic = true
32
+ if metadata.relation.stores_foreign_key?
33
+ field(metadata.inverse_type, :type => String)
34
+ end
35
+ end
36
+ end
37
+ end
38
+
39
+ # Determines if the class is in a polymorphic relations, and thus must
40
+ # store the _type field in the database.
41
+ #
42
+ # @example Check if the class is polymorphic.
43
+ # Movie.polymorphic?
44
+ #
45
+ # @return [ true, false ] True if polymorphic, false if not.
46
+ #
47
+ # @since 2.0.0.rc.1
48
+ def polymorphic?
49
+ !!polymorphic
50
+ end
51
+ end
52
+ end
53
+ end
54
+ end
@@ -0,0 +1,122 @@
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
+ DEFAULT_OPTIONS = { :building => false, :continue => true }
10
+
11
+ # We undefine most methods to get them sent through to the target.
12
+ instance_methods.each do |method|
13
+ undef_method(method) unless
14
+ method =~ /(^__|^send$|^object_id$|^extend$|^tap$)/
15
+ end
16
+
17
+ attr_accessor :base, :metadata, :target
18
+
19
+ # Backwards compatibiloty with Mongoid beta releases.
20
+ delegate :klass, :to => :metadata
21
+
22
+ # Convenience for setting the target and the metadata properties since
23
+ # all proxies will need to do this.
24
+ #
25
+ # @example Initialize the proxy.
26
+ # proxy.init(person, name, metadata)
27
+ #
28
+ # @param [ Document ] base The base document on the proxy.
29
+ # @param [ Document, Array<Document> ] target The target of the proxy.
30
+ # @param [ Metadata ] metadata The relation's metadata.
31
+ #
32
+ # @since 2.0.0.rc.1
33
+ def init(base, target, metadata, &block)
34
+ @base, @building, @target, @metadata = base, false, target, metadata
35
+ metadatafy(target)
36
+ yield block if block_given?
37
+ extend Module.new(&metadata.extension) if metadata.extension?
38
+ end
39
+
40
+ protected
41
+
42
+ # Yields to the block to allow the building flag to get set and unset for
43
+ # the supplied code.
44
+ #
45
+ # @example Set the building status.
46
+ # person.building { @target << Post.new }
47
+ #
48
+ # @since 2.0.0.rc.1
49
+ def building(&block)
50
+ @building = true
51
+ yield block if block_given?
52
+ @building = false
53
+ end
54
+
55
+ # Convenience method for determining if we are building an association.
56
+ # We never want to save in this case.
57
+ #
58
+ # @example Are we currently building?
59
+ # person.posts.building?
60
+ #
61
+ # @return [ true, false ] True if currently building, false if not.
62
+ #
63
+ # @since 2.0.0.rc.1
64
+ def building?
65
+ !!@building
66
+ end
67
+
68
+ # Return a new document for the type of class we want to instantiate.
69
+ # If the type is provided use that, otherwise the klass from the
70
+ # metadata.
71
+ #
72
+ # @example Get an instantiated document.
73
+ # proxy.instantiated(Person)
74
+ #
75
+ # @param [ Class ] type The type of class to instantiate.
76
+ #
77
+ # @return [ Document ] The freshly created document.
78
+ #
79
+ # @since 2.0.0.rc.1
80
+ def instantiated(type = nil)
81
+ type ? type.instantiate : metadata.klass.instantiate
82
+ end
83
+
84
+ # Determines if the target been loaded into memory or not.
85
+ #
86
+ # @example Is the proxy loaded?
87
+ # proxy.loaded?
88
+ #
89
+ # @return [ true, false ] True if loaded, false if not.
90
+ #
91
+ # @since 2.0.0.rc.1
92
+ def loaded?
93
+ !target.is_a?(Mongoid::Criteria)
94
+ end
95
+
96
+ # Takes the supplied document and sets the metadata on it. Used when
97
+ # creating new documents and adding them to the relation.
98
+ #
99
+ # @example Set the metadata.
100
+ # proxy.metadatafy(address)
101
+ #
102
+ # @param [ Document, Array<Document> ] object The object to set the
103
+ # metadata on.
104
+ #
105
+ # @since 2.0.0.rc.1
106
+ def metadatafy(object)
107
+ object.to_a.each do |obj|
108
+ obj.metadata = metadata unless obj.metadata
109
+ end
110
+ end
111
+
112
+ # Default behavior of method missing should be to delegate all calls
113
+ # to the target of the proxy. This can be overridden in special cases.
114
+ #
115
+ # @param [ String, Symbol ] name The name of the method.
116
+ # @param [ Array ] *args The arguments passed to the method.
117
+ def method_missing(name, *args, &block)
118
+ target.send(name, *args, &block)
119
+ end
120
+ end
121
+ end
122
+ end
@@ -0,0 +1,214 @@
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 ] :building 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)
44
+ end
45
+
46
+ # Substitutes the supplied target documents for the existing document
47
+ # in the relation.
48
+ #
49
+ # @example Substitute the relation.
50
+ # name.substitute(new_name)
51
+ #
52
+ # @param [ Document, Array<Document> ] new_target The replacement.
53
+ # @param [ true, false ] building Are we in build mode?
54
+ #
55
+ # @return [ In, nil ] The relation or nil.
56
+ #
57
+ # @since 2.0.0.rc.1
58
+ def substitute(new_target, options = {})
59
+ old_target = target
60
+ tap do |relation|
61
+ relation.target = new_target
62
+ if new_target
63
+ bind(options)
64
+ else
65
+ unbind(old_target, options)
66
+ nil
67
+ end
68
+ end
69
+ end
70
+
71
+ # Unbinds the base object to the inverse of the relation. This occurs
72
+ # when setting a side of the relation to nil.
73
+ #
74
+ # @example Unbind the relation.
75
+ # game.person.unbind
76
+ #
77
+ # @param [ Document, Array<Document> ] old_target The previous target.
78
+ # @param [ Hash ] options The options to bind with.
79
+ #
80
+ # @option options [ true, false ] :building Are we in build mode?
81
+ # @option options [ true, false ] :continue Continue binding the
82
+ # inverse?
83
+ #
84
+ # @since 2.0.0.rc.1
85
+ def unbind(old_target, options = {})
86
+ binding(old_target).unbind(options)
87
+ end
88
+
89
+ private
90
+
91
+ # Instantiate the binding associated with this relation.
92
+ #
93
+ # @example Get the binding object.
94
+ # binding([ address ])
95
+ #
96
+ # @param [ Document, Array<Document> ] new_target The replacement.
97
+ #
98
+ # @return [ Binding ] The binding object.
99
+ #
100
+ # @since 2.0.0.rc.1
101
+ def binding(new_target = nil)
102
+ Bindings::Referenced::In.new(base, new_target || target, metadata)
103
+ end
104
+
105
+ class << self
106
+
107
+ # Return the builder that is responsible for generating the documents
108
+ # that will be used by this relation.
109
+ #
110
+ # @example Get the builder.
111
+ # Referenced::In.builder(meta, object)
112
+ #
113
+ # @param [ Metadata ] meta The metadata of the relation.
114
+ # @param [ Document, Hash ] object A document or attributes to build
115
+ # with.
116
+ #
117
+ # @return [ Builder ] A new builder object.
118
+ #
119
+ # @since 2.0.0.rc.1
120
+ def builder(meta, object)
121
+ Builders::Referenced::In.new(meta, object)
122
+ end
123
+
124
+ # Returns true if the relation is an embedded one. In this case
125
+ # always false.
126
+ #
127
+ # @example Is this relation embedded?
128
+ # Referenced::In.embedded?
129
+ #
130
+ # @return [ false ] Always false.
131
+ #
132
+ # @since 2.0.0.rc.1
133
+ def embedded?
134
+ false
135
+ end
136
+
137
+ # Get the default value for the foreign key.
138
+ #
139
+ # @example Get the default.
140
+ # Referenced::In.foreign_key_default
141
+ #
142
+ # @return [ nil ] Always nil.
143
+ #
144
+ # @since 2.0.0.rc.1
145
+ def foreign_key_default
146
+ nil
147
+ end
148
+
149
+ # Returns the suffix of the foreign key field, either "_id" or "_ids".
150
+ #
151
+ # @example Get the suffix for the foreign key.
152
+ # Referenced::In.foreign_key_suffix
153
+ #
154
+ # @return [ String ] "_id"
155
+ #
156
+ # @since 2.0.0.rc.1
157
+ def foreign_key_suffix
158
+ "_id"
159
+ end
160
+
161
+ # Returns the macro for this relation. Used mostly as a helper in
162
+ # reflection.
163
+ #
164
+ # @example Get the macro.
165
+ # Referenced::In.macro
166
+ #
167
+ # @return [ Symbol ] :referenced_in
168
+ def macro
169
+ :referenced_in
170
+ end
171
+
172
+ # Return the nested builder that is responsible for generating the documents
173
+ # that will be used by this relation.
174
+ #
175
+ # @example Get the nested builder.
176
+ # Referenced::In.builder(attributes, options)
177
+ #
178
+ # @param [ Metadata ] metadata The relation metadata.
179
+ # @param [ Hash ] attributes The attributes to build with.
180
+ # @param [ Hash ] options The options for the builder.
181
+ #
182
+ # @option options [ true, false ] :allow_destroy Can documents be
183
+ # deleted?
184
+ # @option options [ Integer ] :limit Max number of documents to
185
+ # create at once.
186
+ # @option options [ Proc, Symbol ] :reject_if If documents match this
187
+ # option then they are ignored.
188
+ # @option options [ true, false ] :update_only Only existing documents
189
+ # can be modified.
190
+ #
191
+ # @return [ NestedBuilder ] A newly instantiated nested builder object.
192
+ #
193
+ # @since 2.0.0.rc.1
194
+ def nested_builder(metadata, attributes, options)
195
+ Builders::NestedAttributes::One.new(metadata, attributes, options)
196
+ end
197
+
198
+ # Tells the caller if this relation is one that stores the foreign
199
+ # key on its own objects.
200
+ #
201
+ # @example Does this relation store a foreign key?
202
+ # Referenced::In.stores_foreign_key?
203
+ #
204
+ # @return [ true ] Always true.
205
+ #
206
+ # @since 2.0.0.rc.1
207
+ def stores_foreign_key?
208
+ true
209
+ end
210
+ end
211
+ end
212
+ end
213
+ end
214
+ end