From 671228942d1a49f223739f249728eebbc590f66e Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Mon, 15 Oct 2007 08:09:04 +0000 Subject: Alias association #build to #new so it behaves predictably. Closes #8787. git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7913 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- .../lib/active_record/associations/has_many_through_association.rb | 1 + 1 file changed, 1 insertion(+) (limited to 'activerecord/lib/active_record/associations/has_many_through_association.rb') diff --git a/activerecord/lib/active_record/associations/has_many_through_association.rb b/activerecord/lib/active_record/associations/has_many_through_association.rb index 62839c4637..5bb306c060 100644 --- a/activerecord/lib/active_record/associations/has_many_through_association.rb +++ b/activerecord/lib/active_record/associations/has_many_through_association.rb @@ -88,6 +88,7 @@ module ActiveRecord def build(attrs = nil) raise ActiveRecord::HasManyThroughCantAssociateNewRecords.new(@owner, @reflection.through_reflection) end + alias_method :new, :build def create!(attrs = nil) @reflection.klass.transaction do -- cgit v1.2.3