diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2010-12-10 17:03:32 -0800 |
---|---|---|
committer | Vijay Dev <vijaydev.cse@gmail.com> | 2010-12-16 01:49:28 +0530 |
commit | ad47b7bcc11aae7745b39354292b089ae18a8cfc (patch) | |
tree | d406049563b93919814a2fbb1f3e475cd0ff7fb6 /activerecord/lib/active_record | |
parent | 59bd9c2a3793febffb919f1555156208825d4a9c (diff) | |
download | rails-ad47b7bcc11aae7745b39354292b089ae18a8cfc.tar.gz rails-ad47b7bcc11aae7745b39354292b089ae18a8cfc.tar.bz2 rails-ad47b7bcc11aae7745b39354292b089ae18a8cfc.zip |
just use the regexp directly
Diffstat (limited to 'activerecord/lib/active_record')
-rw-r--r-- | activerecord/lib/active_record/associations/class_methods/join_dependency.rb | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/activerecord/lib/active_record/associations/class_methods/join_dependency.rb b/activerecord/lib/active_record/associations/class_methods/join_dependency.rb index 6be947df41..5a0ff942ca 100644 --- a/activerecord/lib/active_record/associations/class_methods/join_dependency.rb +++ b/activerecord/lib/active_record/associations/class_methods/join_dependency.rb @@ -58,18 +58,16 @@ module ActiveRecord when Arel::Table right.name.downcase == name ? 1 : 0 when String - count_aliases_from_string(right.downcase, quoted_name) + # Table names + table aliases + right.downcase.scan( + /join(?:\s+\w+)?\s+(\S+\s+)?#{quoted_name}\son/ + ).size else 0 end }.sum end - def count_aliases_from_string(join_sql, name) - # Table names + table aliases - join_sql.scan(/join(?:\s+\w+)?\s+(\S+\s+)?#{name}\son/).size - end - def instantiate(rows) primary_key = join_base.aliased_primary_key parents = {} |