diff options
author | Jon Leighton <j@jonathanleighton.com> | 2011-08-08 23:27:54 +0100 |
---|---|---|
committer | Jon Leighton <j@jonathanleighton.com> | 2011-08-08 23:28:23 +0100 |
commit | 7db90aa7c7dfe5033ad012b8ee13e6f15d1c66f0 (patch) | |
tree | c878847de183caa1c3807e5253baf7d1fdfe0f65 /activerecord/lib/active_record/relation/finder_methods.rb | |
parent | ff9a2e66975e8a5c9cc361ec1fd61980cd14eb3e (diff) | |
download | rails-7db90aa7c7dfe5033ad012b8ee13e6f15d1c66f0.tar.gz rails-7db90aa7c7dfe5033ad012b8ee13e6f15d1c66f0.tar.bz2 rails-7db90aa7c7dfe5033ad012b8ee13e6f15d1c66f0.zip |
Make it the responsibility of the connection to hold onto an ARel visitor for generating SQL. This improves the code architecture generally, and solves some problems with marshalling. Adapter authors please take note: you now need to define an Adapter.visitor_for method, but it degrades gracefully with a deprecation warning for now.
Diffstat (limited to 'activerecord/lib/active_record/relation/finder_methods.rb')
-rw-r--r-- | activerecord/lib/active_record/relation/finder_methods.rb | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/activerecord/lib/active_record/relation/finder_methods.rb b/activerecord/lib/active_record/relation/finder_methods.rb index 8cef4e5554..73368aed18 100644 --- a/activerecord/lib/active_record/relation/finder_methods.rb +++ b/activerecord/lib/active_record/relation/finder_methods.rb @@ -193,8 +193,8 @@ module ActiveRecord else relation = relation.where(table[primary_key].eq(id)) if id end - - connection.select_value(relation.to_sql, "#{name} Exists") ? true : false + + connection.select_value(relation, "#{name} Exists") ? true : false end protected @@ -202,7 +202,7 @@ module ActiveRecord def find_with_associations join_dependency = construct_join_dependency_for_association_find relation = construct_relation_for_association_find(join_dependency) - rows = connection.select_all(relation.to_sql, 'SQL', relation.bind_values) + rows = connection.select_all(relation, 'SQL', relation.bind_values) join_dependency.instantiate(rows) rescue ThrowResult [] |