From 3da275c4396d7fad250d2b786027ba4f14344bd4 Mon Sep 17 00:00:00 2001 From: beerlington Date: Tue, 11 Sep 2012 14:11:51 -0400 Subject: Accept belongs_to assoc. keys in ActiveRecord queries Allows you to specify the model association key in a belongs_to relationship instead of the foreign key. The following queries are now equivalent: Post.where(:author_id => Author.first) Post.where(:author => Author.first) PriceEstimate.where(:estimate_of_type => 'Treasure', :estimate_of_id => treasure) PriceEstimate.where(:estimate_of => treasure) --- activerecord/CHANGELOG.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'activerecord/CHANGELOG.md') diff --git a/activerecord/CHANGELOG.md b/activerecord/CHANGELOG.md index e94db776a5..818b69b6b8 100644 --- a/activerecord/CHANGELOG.md +++ b/activerecord/CHANGELOG.md @@ -1,5 +1,17 @@ ## Rails 4.0.0 (unreleased) ## +* Accept belongs_to (including polymorphic) association keys in queries + + The following queries are now equivalent: + + Post.where(:author => author) + Post.where(:author_id => author) + + PriceEstimate.where(:estimate_of => treasure) + PriceEstimate.where(:estimate_of_type => 'Treasure', :estimate_of_id => treasure) + + *Peter Brown* + * Use native `mysqldump` command instead of `structure_dump` method when dumping the database structure to a sql file. Fixes #5547. -- cgit v1.2.3