diff options
author | Xavier Noria <fxn@hashref.com> | 2011-11-25 14:29:34 -0800 |
---|---|---|
committer | Xavier Noria <fxn@hashref.com> | 2011-11-25 14:29:34 -0800 |
commit | 1be9830d4d99e2bf56f1cadf74b843f22d66da35 (patch) | |
tree | f4acc78649b273bc1bf97fe4bb70e3ca9167ffbf /activerecord/test/cases/adapters/mysql2 | |
parent | a5b362df567ed4a0167a83e9b8f00b9f614ac38b (diff) | |
download | rails-1be9830d4d99e2bf56f1cadf74b843f22d66da35.tar.gz rails-1be9830d4d99e2bf56f1cadf74b843f22d66da35.tar.bz2 rails-1be9830d4d99e2bf56f1cadf74b843f22d66da35.zip |
add the query to AR::Relation#explain output
Rationale: this is more readable if serveral queries
are involved in one call. Also, it will be possible
to let AR log EXPLAINs automatically in production
mode, where queries are not even around.
Diffstat (limited to 'activerecord/test/cases/adapters/mysql2')
-rw-r--r-- | activerecord/test/cases/adapters/mysql2/explain_test.rb | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/activerecord/test/cases/adapters/mysql2/explain_test.rb b/activerecord/test/cases/adapters/mysql2/explain_test.rb index 8ea777b72b..68ed361aeb 100644 --- a/activerecord/test/cases/adapters/mysql2/explain_test.rb +++ b/activerecord/test/cases/adapters/mysql2/explain_test.rb @@ -9,12 +9,15 @@ module ActiveRecord def test_explain_for_one_query explain = Developer.where(:id => 1).explain + assert_match %(EXPLAIN for: SELECT `developers`.* FROM `developers` WHERE `developers`.`id` = 1), explain assert_match %(developers | const), explain end def test_explain_with_eager_loading explain = Developer.where(:id => 1).includes(:audit_logs).explain + assert_match %(EXPLAIN for: SELECT `developers`.* FROM `developers` WHERE `developers`.`id` = 1), explain assert_match %(developers | const), explain + assert_match %(EXPLAIN for: SELECT `audit_logs`.* FROM `audit_logs` WHERE `audit_logs`.`developer_id` IN (1)), explain assert_match %(audit_logs | ALL), explain end end |