method
build
v5.2.3 -
Show latest stable
- Class:
ActiveRecord::Associations::Builder::Association
build(model, name, scope, options, &block)public
No documentation available.
# File activerecord/lib/active_record/associations/builder/association.rb, line 23
def self.build(model, name, scope, options, &block)
if model.dangerous_attribute_method?(name)
raise ArgumentError, "You tried to define an association named #{name} on the model #{model.name}, but " "this will conflict with a method #{name} already defined by Active Record. " "Please choose a different association name."
end
extension = define_extensions model, name, &block
reflection = create_reflection model, name, scope, options, extension
define_accessors model, reflection
define_callbacks model, reflection
define_validations model, reflection
reflection
end