diff options
author | Melanie Gilman <melanie@thoughtbot.com> | 2014-12-01 16:02:21 -0500 |
---|---|---|
committer | Melanie Gilman <melanie@thoughtbot.com> | 2014-12-02 15:49:16 -0500 |
commit | fcc3cbc71f49f56ac5e4f4925c8c1114c08e54c5 (patch) | |
tree | e16ef8f2aa451cb9a6b546f1933527491bdfab7f /activerecord/test/cases | |
parent | 3317d6958cf5627ac8db8ce4086639efa5adad43 (diff) | |
download | rails-fcc3cbc71f49f56ac5e4f4925c8c1114c08e54c5.tar.gz rails-fcc3cbc71f49f56ac5e4f4925c8c1114c08e54c5.tar.bz2 rails-fcc3cbc71f49f56ac5e4f4925c8c1114c08e54c5.zip |
Refactor `build_from_hash` to convert dot notation to hash first
This ensures that we're handling all forms of nested tables the same way.
We're aware that the `convert_dot_notation_to_hash` method will cause a
performance hit, and we intend to come back to it once we've refactored some of
the surrounding code.
[Melissa Xie & Melanie Gilman]
Diffstat (limited to 'activerecord/test/cases')
-rw-r--r-- | activerecord/test/cases/finder_test.rb | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/activerecord/test/cases/finder_test.rb b/activerecord/test/cases/finder_test.rb index a607c1319f..f24b30c685 100644 --- a/activerecord/test/cases/finder_test.rb +++ b/activerecord/test/cases/finder_test.rb @@ -489,6 +489,12 @@ class FinderTest < ActiveRecord::TestCase assert_raise(ActiveRecord::RecordNotFound) { Topic.where(topics: { approved: true }).find(1) } end + def test_find_on_combined_explicit_and_hashed_table_names + assert Topic.where('topics.approved' => false, topics: { author_name: "David" }).find(1) + assert_raise(ActiveRecord::RecordNotFound) { Topic.where('topics.approved' => true, topics: { author_name: "David" }).find(1) } + assert_raise(ActiveRecord::RecordNotFound) { Topic.where('topics.approved' => false, topics: { author_name: "Melanie" }).find(1) } + end + def test_find_with_hash_conditions_on_joined_table firms = Firm.joins(:account).where(:accounts => { :credit_limit => 50 }) assert_equal 1, firms.size |