aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/CHANGELOG
diff options
context:
space:
mode:
authorJeremy Kemper <jeremy@bitsweat.net>2006-08-18 07:35:07 +0000
committerJeremy Kemper <jeremy@bitsweat.net>2006-08-18 07:35:07 +0000
commit0da426be96d9e02b1b7a34e364dff984cd4218f3 (patch)
treede89954a3a945e2a8f7750684e4eeea1a9f05ee4 /activerecord/CHANGELOG
parent18057d2fb6017df988fadc6496f187c2e6208277 (diff)
downloadrails-0da426be96d9e02b1b7a34e364dff984cd4218f3.tar.gz
rails-0da426be96d9e02b1b7a34e364dff984cd4218f3.tar.bz2
rails-0da426be96d9e02b1b7a34e364dff984cd4218f3.zip
Add records to has_many :through using <<, push, and concat by creating the association record. Raise if base or associate are new records since both ids are required to create the association. #build raises since you can't associate an unsaved record. #create! takes an attributes hash and creates the associated record and its association in a transaction.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4786 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activerecord/CHANGELOG')
-rw-r--r--activerecord/CHANGELOG12
1 files changed, 12 insertions, 0 deletions
diff --git a/activerecord/CHANGELOG b/activerecord/CHANGELOG
index 47e7531c68..dbe7d81623 100644
--- a/activerecord/CHANGELOG
+++ b/activerecord/CHANGELOG
@@ -1,5 +1,17 @@
*SVN*
+* Add records to has_many :through using <<, push, and concat by creating the association record. Raise if base or associate are new records since both ids are required to create the association. #build raises since you can't associate an unsaved record. #create! takes an attributes hash and creates the associated record and its association in a transaction. [Jeremy Kemper]
+
+ # Create a tagging to associate the post and tag.
+ post.tags << Tag.find_by_name('old')
+ post.tags.create! :name => 'general'
+
+ # Would have been:
+ post.taggings.create!(:tag => Tag.find_by_name('finally')
+ transaction do
+ post.taggings.create!(:tag => Tag.create!(:name => 'general'))
+ end
+
* Cache nil results for :included has_one associations also. #5787 [Michael Schoen]
* Fixed a bug which would cause .save to fail after trying to access a empty has_one association on a unsaved record. [Tobias Luetke]