def number_of_records_to_create(name, options={})
      current = self.send(name).size
      default_count = current == 0 ? 1 : 0

      if options[:append]
        1
      elsif options[:count]
        options[:count]
      else
        default_count
      end
    end
def number_of_records_to_create(name, options={})
      current = self.send(name).size
      default_count = current == 0 ? 1 : 0

      if options[:append]
        1
      elsif options[:count]
        options[:count]
      else
        default_count
      end
    end
Private: Calculates the number of new records to create in a
 `has_many` association.

 name    - A Symbol with the name of the association.
 options - The Hash options for the number of records to create.
           See AutoBuilder::Association#initialize for more
           details.

 Examples

   User.projects.size
   # => 1

   number_of_records_to_create(:projects)
   # => 0

   number_of_records_to_create(:projects, :append => true)
   # => 1

   number_of_records_to_create(:projects, :count => 4)
   # => 4 (User.projects.size == 5)

 Returns the number of records to create.