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,154 @@
1
+ # encoding: utf-8
2
+ module Mongoid # :nodoc:
3
+ module Relations #:nodoc:
4
+
5
+ # This module contains all the behaviour related to accessing relations
6
+ # through the getters and setters, and how to delegate to builders to
7
+ # create new ones.
8
+ module Accessors
9
+ extend ActiveSupport::Concern
10
+
11
+ # Builds the related document and creates the relation unless the
12
+ # document is nil, then sets the relation on this document.
13
+ #
14
+ # @example Build the relation.
15
+ # person.build(:addresses, { :id => 1 }, metadata)
16
+ #
17
+ # @param [ String, Symbol ] name The name of the relation.
18
+ # @param [ Hash, BSON::ObjectId ] object The id or attributes to use.
19
+ # @param [ Metadata ] metadata The relation's metadata.
20
+ # @param [ true, false ] building If we are in a build operation.
21
+ #
22
+ # @return [ Proxy ] The relation.
23
+ #
24
+ # @since 2.0.0.rc.1
25
+ def build(name, object, metadata, options = {})
26
+ relation = create_relation(object, metadata)
27
+ set(name, relation).tap do |relation|
28
+ relation.bind(options) if relation
29
+ end
30
+ end
31
+
32
+ # Return the options passed to the builders.
33
+ #
34
+ # @example Get the options.
35
+ # person.configurables(document, :continue => true)
36
+ #
37
+ # @param [ Array ] args The arguments to check.
38
+ #
39
+ # @return [ Hash ] The options.
40
+ #
41
+ # @since 2.0.0.rc.1
42
+ def configurables(args)
43
+ options = args.extract_options!
44
+ options.merge!(:building => false) unless options[:building] == true
45
+ { :building => true, :continue => true }.merge(options)
46
+ end
47
+
48
+ # Create a relation from an object and metadata.
49
+ #
50
+ # @example Create the relation.
51
+ # person.create_relation(document, metadata)
52
+ #
53
+ # @param [ Document, Array<Document ] object The relation target.
54
+ # @param [ Metadata ] metadata The relation metadata.
55
+ #
56
+ # @return [ Proxy ] The relation.
57
+ #
58
+ # @since 2.0.0.rc.1
59
+ def create_relation(object, metadata)
60
+ type = @attributes[metadata.inverse_type]
61
+ target = metadata.builder(object).build(type)
62
+ target ? metadata.relation.new(self, target, metadata) : nil
63
+ end
64
+
65
+ # Determines if the relation exists or not.
66
+ #
67
+ # @example Does the relation exist?
68
+ # person.relation_exists?(:people)
69
+ #
70
+ # @param [ String ] name The name of the relation to check.
71
+ #
72
+ # @return [ true, false ] True if set and not nil, false if not.
73
+ #
74
+ # @since 2.0.0.rc.1
75
+ def relation_exists?(name)
76
+ ivar(name)
77
+ end
78
+
79
+ # Set the supplied relation to an instance variable on the class with the
80
+ # provided name. Used as a helper just for code cleanliness.
81
+ #
82
+ # @example Set the proxy on the document.
83
+ # person.set(:addresses, addresses)
84
+ #
85
+ # @param [ String, Symbol ] name The name of the relation.
86
+ # @param [ Proxy ] relation The relation to set.
87
+ #
88
+ # @return [ Proxy ] The relation.
89
+ #
90
+ # @since 2.0.0.rc.1
91
+ def set(name, relation)
92
+ instance_variable_set("@#{name}", relation)
93
+ end
94
+
95
+ module ClassMethods #:nodoc:
96
+
97
+ # Defines the getter for the relation. Nothing too special here: just
98
+ # return the instance variable for the relation if it exists or build
99
+ # the thing.
100
+ #
101
+ # @example Set up the getter for the relation.
102
+ # Person.getter("addresses", metadata)
103
+ #
104
+ # @param [ String, Symbol ] name The name of the relation.
105
+ # @param [ Metadata ] metadata The metadata for the relation.
106
+ #
107
+ # @return [ Class ] The class being set up.
108
+ #
109
+ # @since 2.0.0.rc.1
110
+ def getter(name, metadata)
111
+ tap do
112
+ define_method(name) do |*args|
113
+ reload, variable = args.first, "@#{name}"
114
+ options = configurables(args)
115
+ if instance_variable_defined?(variable) && !reload
116
+ instance_variable_get(variable)
117
+ else
118
+ build(name, @attributes[metadata.key], metadata, options)
119
+ end
120
+ end
121
+ end
122
+ end
123
+
124
+ # Defines the setter for the relation. This does a few things based on
125
+ # some conditions. If there is an existing association, a target
126
+ # substitution will take place, otherwise a new relation will be
127
+ # created with the supplied target.
128
+ #
129
+ # @example Set up the setter for the relation.
130
+ # Person.setter("addresses", metadata)
131
+ #
132
+ # @param [ String, Symbol ] name The name of the relation.
133
+ # @param [ Metadata ] metadata The metadata for the relation.
134
+ #
135
+ # @return [ Class ] The class being set up.
136
+ #
137
+ # @since 2.0.0.rc.1
138
+ def setter(name, metadata)
139
+ tap do
140
+ define_method("#{name}=") do |*args|
141
+ object, options = args.first, configurables(args)
142
+ variable = "@#{name}"
143
+ if relation_exists?(name)
144
+ set(name, ivar(name).substitute(object, options))
145
+ else
146
+ build(name, object, metadata, options)
147
+ end
148
+ end
149
+ end
150
+ end
151
+ end
152
+ end
153
+ end
154
+ end
@@ -0,0 +1,34 @@
1
+ # encoding: utf-8
2
+ module Mongoid # :nodoc:
3
+ module Relations #:nodoc:
4
+
5
+ # This module contains the behaviour for auto-saving relations in
6
+ # different collections.
7
+ module AutoSave
8
+ extend ActiveSupport::Concern
9
+
10
+ module ClassMethods #:nodoc:
11
+
12
+ # Set up the autosave behaviour for references many and references one
13
+ # relations. When the option is set to true, these relations will get
14
+ # saved automatically when the parent is first saved, but not if the
15
+ # parent already exists in the database.
16
+ #
17
+ # @example Set up autosave options.
18
+ # Person.autosave(metadata)
19
+ #
20
+ # @param [ Metadata ] metadata The relation metadata.
21
+ #
22
+ # @since 2.0.0.rc.1
23
+ def autosave(metadata)
24
+ if metadata.autosave?
25
+ set_callback :create, :after do |document|
26
+ relation = document.send(metadata.name)
27
+ relation.to_a.each(&:save) if relation
28
+ end
29
+ end
30
+ end
31
+ end
32
+ end
33
+ end
34
+ end
@@ -0,0 +1,24 @@
1
+ # encoding: utf-8
2
+ module Mongoid # :nodoc:
3
+ module Relations #:nodoc:
4
+
5
+ # Superclass for all objects that bind relations together.
6
+ class Binding
7
+ attr_reader :base, :target, :metadata
8
+
9
+ # Create the new binding.
10
+ #
11
+ # @example Initialize a binding.
12
+ # Binding.new(base, target, metadata)
13
+ #
14
+ # @param [ Document ] base The base of the binding.
15
+ # @param [ Document, Array<Document> ] target The target of the binding.
16
+ # @param [ Metadata ] metadata The relation's metadata.
17
+ #
18
+ # @since 2.0.0.rc.1
19
+ def initialize(base, target, metadata)
20
+ @base, @target, @metadata = base, target, metadata
21
+ end
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,9 @@
1
+ # encoding: utf-8
2
+ require "mongoid/relations/binding"
3
+ require "mongoid/relations/bindings/embedded/in"
4
+ require "mongoid/relations/bindings/embedded/many"
5
+ require "mongoid/relations/bindings/embedded/one"
6
+ require "mongoid/relations/bindings/referenced/in"
7
+ require "mongoid/relations/bindings/referenced/many"
8
+ require "mongoid/relations/bindings/referenced/many_to_many"
9
+ require "mongoid/relations/bindings/referenced/one"
@@ -0,0 +1,77 @@
1
+ # encoding: utf-8
2
+ module Mongoid # :nodoc:
3
+ module Relations #:nodoc:
4
+ module Bindings #:nodoc:
5
+ module Embedded #:nodoc:
6
+
7
+ # Binding class for embedded_in relations.
8
+ class In < Binding
9
+
10
+ # Binds the base object to the inverse of the relation. This is so we
11
+ # are referenced to the actual objects themselves on both sides.
12
+ #
13
+ # This case sets the metadata on the inverse object as well as the
14
+ # document itself.
15
+ #
16
+ # @example Bind the documents.
17
+ # name.person.bind(:continue => true)
18
+ # name.person = Person.new
19
+ #
20
+ # @param [ Hash ] options The binding options.
21
+ #
22
+ # @option options [ true, false ] :continue Continue binding the inverse.
23
+ # @option options [ true, false ] :building Are we in build mode?
24
+ #
25
+ # @since 2.0.0.rc.1
26
+ def bind(options = {})
27
+ inverse = metadata.inverse(target)
28
+ base.metadata = target.reflect_on_association(inverse)
29
+ base.parentize(target)
30
+ if options[:continue]
31
+ if base.embedded_many?
32
+ target.do_or_do_not(
33
+ inverse,
34
+ false,
35
+ :building => true,
36
+ :continue => false
37
+ ).push(base, :building => true, :continue => false)
38
+ else
39
+ target.do_or_do_not(
40
+ metadata.inverse_setter(target),
41
+ base,
42
+ :building => true,
43
+ :continue => false
44
+ )
45
+ end
46
+ end
47
+ end
48
+ alias :bind_one :bind
49
+
50
+ # Unbinds the base object and the inverse, caused by setting the
51
+ # reference to nil.
52
+ #
53
+ # @example Unbind the document.
54
+ # name.person.unbind(:continue => true)
55
+ # name.person = nil
56
+ #
57
+ # @param [ Hash ] options The options to pass through.
58
+ #
59
+ # @option options [ true, false ] :continue Do we continue unbinding?
60
+ #
61
+ # @since 2.0.0.rc.1
62
+ def unbind(options = {})
63
+ if options[:continue]
64
+ if base.embedded_many?
65
+ inverse = metadata.inverse(target)
66
+ target.do_or_do_not(inverse).delete(base)
67
+ else
68
+ target.do_or_do_not(metadata.inverse_setter(target), nil, :continue => false)
69
+ end
70
+ end
71
+ end
72
+ alias :unbind_one :unbind
73
+ end
74
+ end
75
+ end
76
+ end
77
+ end
@@ -0,0 +1,93 @@
1
+ # encoding: utf-8
2
+ module Mongoid # :nodoc:
3
+ module Relations #:nodoc:
4
+ module Bindings #:nodoc:
5
+ module Embedded #:nodoc:
6
+
7
+ # Binding class for embeds_many relations.
8
+ class Many < Binding
9
+
10
+ # Binds the base object to the inverse of the relation. This is so we
11
+ # are referenced to the actual objects themselves on both sides.
12
+ #
13
+ # This case sets the metadata on the inverse object as well as the
14
+ # document itself.
15
+ #
16
+ # @example Bind all the documents.
17
+ # person.addresses.bind
18
+ # person.addresses = [ Address.new ]
19
+ #
20
+ # @param [ Hash ] options The binding options.
21
+ #
22
+ # @option options [ true, false ] :continue Continue binding the inverse.
23
+ # @option options [ true, false ] :building Are we in build mode?
24
+ #
25
+ # @since 2.0.0.rc.1
26
+ def bind(options = {})
27
+ target.each { |doc| bind_one(doc, options) }
28
+ end
29
+
30
+ # Binds a single document with the inverse relation. Used
31
+ # specifically when appending to the proxy.
32
+ #
33
+ # @example Bind one document.
34
+ # person.addresses.bind_one(address)
35
+ #
36
+ # @param [ Document ] doc The single document to bind.
37
+ # @param [ Hash ] options The binding options.
38
+ #
39
+ # @option options [ true, false ] :continue Continue binding the inverse.
40
+ # @option options [ true, false ] :building Are we in build mode?
41
+ #
42
+ # @since 2.0.0.rc.1
43
+ def bind_one(doc, options = {})
44
+ doc.parentize(base)
45
+ if options[:continue]
46
+ name = metadata.inverse_setter(target)
47
+ doc.do_or_do_not(
48
+ name,
49
+ base,
50
+ :building => true,
51
+ :continue => false
52
+ ) unless name == "versions="
53
+ end
54
+ end
55
+
56
+ # Unbinds the base object and the inverse, caused by setting the
57
+ # reference to nil.
58
+ #
59
+ # @example Unbind the documents.
60
+ # person.addresses.unbind
61
+ # person.addresses = nil
62
+ #
63
+ # @param [ Hash ] options The binding options.
64
+ #
65
+ # @option options [ true, false ] :continue Continue binding the inverse.
66
+ # @option options [ true, false ] :building Are we in build mode?
67
+ #
68
+ # @since 2.0.0.rc.1
69
+ def unbind(options = {})
70
+ target.each { |doc| unbind_one(doc, options) }
71
+ end
72
+
73
+ # Unbind a single document.
74
+ #
75
+ # @example Unbind the document.
76
+ # person.addresses.unbind_one(document)
77
+ #
78
+ # @param [ Hash ] options The binding options.
79
+ #
80
+ # @option options [ true, false ] :continue Continue binding the inverse.
81
+ # @option options [ true, false ] :building Are we in build mode?
82
+ #
83
+ # @since 2.0.0.rc.1
84
+ def unbind_one(doc, options = {})
85
+ if options[:continue]
86
+ doc.do_or_do_not(metadata.inverse_setter(target), nil, :continue => false)
87
+ end
88
+ end
89
+ end
90
+ end
91
+ end
92
+ end
93
+ end
@@ -0,0 +1,65 @@
1
+ # encoding: utf-8
2
+ module Mongoid # :nodoc:
3
+ module Relations #:nodoc:
4
+ module Bindings #:nodoc:
5
+ module Embedded #:nodoc:
6
+
7
+ # Binding class for embeds_one relations.
8
+ class One < Binding
9
+
10
+ # Binds the base object to the inverse of the relation. This is so we
11
+ # are referenced to the actual objects themselves on both sides.
12
+ #
13
+ # This case sets the metadata on the inverse object as well as the
14
+ # document itself.
15
+ #
16
+ # @example Bind the document.
17
+ # person.name.bind(:continue => true)
18
+ # person.name = Name.new
19
+ #
20
+ # @param [ Hash ] options The options to pass through.
21
+ #
22
+ # @option options [ true, false ] :continue Do we continue binding?
23
+ # @option options [ true, false ] :building Are we in build mode?
24
+ #
25
+ # @since 2.0.0.rc.1
26
+ def bind(options = {})
27
+ if options[:continue]
28
+ target.do_or_do_not(
29
+ metadata.inverse_setter(target),
30
+ base,
31
+ :building => true,
32
+ :continue => false
33
+ )
34
+ end
35
+ end
36
+ alias :bind_one :bind
37
+
38
+ # Unbinds the base object and the inverse, caused by setting the
39
+ # reference to nil.
40
+ #
41
+ # @example Unbind the document.
42
+ # person.name.unbind(:continue => true)
43
+ # person.name = nil
44
+ #
45
+ # @param [ Hash ] options The options to pass through.
46
+ #
47
+ # @option options [ true, false ] :continue Do we continue unbinding?
48
+ # @option options [ true, false ] :building Are we in build mode?
49
+ #
50
+ # @since 2.0.0.rc.1
51
+ def unbind(options = {})
52
+ if options[:continue]
53
+ target.do_or_do_not(
54
+ metadata.inverse_setter(target),
55
+ nil,
56
+ :continue => false
57
+ )
58
+ end
59
+ end
60
+ alias :unbind_one :unbind
61
+ end
62
+ end
63
+ end
64
+ end
65
+ end