diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2010-12-10 17:03:32 -0800 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2010-12-10 17:03:32 -0800 |
commit | 9094cd2600ee0b4f6523dbb80a5fa9e43c81e0c0 (patch) | |
tree | be4c91b9b526be13cd9b1185efa64a0d1be07de9 /activerecord/lib/active_record/associations/class_methods/join_dependency.rb | |
parent | de708447f4bc2ae692440bbac235f9fe04f0702f (diff) | |
download | rails-9094cd2600ee0b4f6523dbb80a5fa9e43c81e0c0.tar.gz rails-9094cd2600ee0b4f6523dbb80a5fa9e43c81e0c0.tar.bz2 rails-9094cd2600ee0b4f6523dbb80a5fa9e43c81e0c0.zip |
just use the regexp directly
Diffstat (limited to 'activerecord/lib/active_record/associations/class_methods/join_dependency.rb')
-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 = {} |