module CustomFieldsManyExtension

  end
end

end

Public Instance Methods

build(attributes = {}, type = nil) click to toggle source
Calls superclass method
# File lib/custom_fields/extensions/mongoid/association/referenced/has_many.rb, line 35
def build(attributes = {}, type = nil)
  if _base.respond_to?(:custom_fields_for?) && _base.custom_fields_for?(association.name)
    # all the information about how to build the custom class are stored here
    recipe = _base.custom_fields_recipe_for(association.name)
    attributes ||= {}
    attributes.merge!(custom_fields_recipe: recipe)
    # build the class with custom_fields for the first time
    type = association.klass.klass_with_custom_fields(recipe)
  end
  super(attributes, type)
end
Also aliased as: new
new(attributes = {}, type = nil)
Alias for: build