module Mongoid::Association::Nested::Buildable
def allow_destroy?
-
(true | false)- True if the allow destroy option was set.
Other tags:
- Example: Do we allow a destroy? -
def allow_destroy? options[:allow_destroy] || false end
def convert_id(klass, id)
-
(BSON::ObjectId | String | Object)- The converted id.
Parameters:
-
id(String) -- The id, usually coming from the form. -
klass(Class) -- The class we're trying to convert for.
Other tags:
- Example: Convert the id. -
def convert_id(klass, id) klass.using_object_ids? ? BSON::ObjectId.mongoize(id) : id end
def reject?(document, attrs)
-
(true | false)- True and call proc or method if rejectable, false if not.
Parameters:
-
attrs(Hash) -- The attributes to check for rejection. -
document(Document) -- The parent document of the association
Other tags:
- Example: Is there a reject proc? -
def reject?(document, attrs) case callback = options[:reject_if] when Symbol document.method(callback).arity == 0 ? document.send(callback) : document.send(callback, attrs) when Proc callback.call(attrs) else false end end
def update_only?
-
(true | false)- True if the update_only option was set.
Other tags:
- Example: Is this update only? -
def update_only? options[:update_only] || false end