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/test/models/treasure.rb | 3 +++ 1 file changed, 3 insertions(+) (limited to 'activerecord/test/models') diff --git a/activerecord/test/models/treasure.rb b/activerecord/test/models/treasure.rb index 2a98e74f2c..e864295acf 100644 --- a/activerecord/test/models/treasure.rb +++ b/activerecord/test/models/treasure.rb @@ -6,3 +6,6 @@ class Treasure < ActiveRecord::Base accepts_nested_attributes_for :looter end + +class HiddenTreasure < Treasure +end -- cgit v1.2.3