August 19, 2006
Older: memcached Intro
Newer: UJS Rails Plugin
has_many :through gets more magic
Yesterday, Jeremy Kemper checked in a change that allows adding records to has_many :through associations using <<, push and concat. This means that has_and_belongs_to_many can officially go the way of the dodo. Now, you can create this type of relationship as easy as:
post.tags << Tag.find_or_create_by_name("magic")
as opposed to the old way:
post.taggings.create!(:tag => Tag.find_or_create_by_name("magic"))
You can read the full summary of the change and a few more tips to go along with it at Josh Susser’s blog.
1 Comment
Oct 15, 2006
I’ve seen this reported as a bug before (http://dev.rubyonrails.org/ticket/5106). I’m glad someone finally fixed it!
Thoughts? Do Tell...