method

build

Importance_0
v2.3.8 - Show latest stable - 0 notes - Class: ActiveRecord::Associations::AssociationCollection
build(attributes = {}, &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/association_collection.rb, line 98
      def build(attributes = {}, &block)
        if attributes.is_a?(Array)
          attributes.collect { |attr| build(attr, &block) }
        else
          build_record(attributes) do |record|
            block.call(record) if block_given?
            set_belongs_to_association_for(record)
          end
        end
      end
Register or log in to add new notes.