diff options
author | beerlington <pete@lette.us> | 2012-09-11 14:11:51 -0400 |
---|---|---|
committer | beerlington <pete@lette.us> | 2012-09-11 14:11:51 -0400 |
commit | 3da275c4396d7fad250d2b786027ba4f14344bd4 (patch) | |
tree | a0367f680705af28ea053e890f82b359fa511a11 /activerecord/test/schema | |
parent | f2a44ade14f995d0574bedf79c8d1bee520f0306 (diff) | |
download | rails-3da275c4396d7fad250d2b786027ba4f14344bd4.tar.gz rails-3da275c4396d7fad250d2b786027ba4f14344bd4.tar.bz2 rails-3da275c4396d7fad250d2b786027ba4f14344bd4.zip |
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)
Diffstat (limited to 'activerecord/test/schema')
-rw-r--r-- | activerecord/test/schema/schema.rb | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/activerecord/test/schema/schema.rb b/activerecord/test/schema/schema.rb index b4e611cb09..798ea20efc 100644 --- a/activerecord/test/schema/schema.rb +++ b/activerecord/test/schema/schema.rb @@ -693,6 +693,7 @@ ActiveRecord::Schema.define do create_table :treasures, :force => true do |t| t.column :name, :string + t.column :type, :string t.column :looter_id, :integer t.column :looter_type, :string end |