Flowdock
method

build

Importance_0
Ruby on Rails latest stable (v4.2.1) - 0 notes - Class: Association
build(model, name, scope, options, &block) public

No documentation

This method has no description. You can help the Ruby on Rails community by adding new notes.

Hide source
# File activerecord/lib/active_record/associations/builder/association.rb, line 28
    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

      builder = create_builder model, name, scope, options, &block
      reflection = builder.build(model)
      define_accessors model, reflection
      define_callbacks model, reflection
      define_validations model, reflection
      builder.define_extensions model
      reflection
    end
Register or log in to add new notes.