diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2010-12-08 12:11:43 -0800 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2010-12-08 12:11:43 -0800 |
commit | 45ea60eee7e6284768b78d51dbed4a2913aa18dd (patch) | |
tree | a45b478b54d4f5bd2685fadb402104a2f49be2aa /activerecord/lib/active_record | |
parent | c69bd59a9cc7c0de3d6db7f8c90e73778516debf (diff) | |
download | rails-45ea60eee7e6284768b78d51dbed4a2913aa18dd.tar.gz rails-45ea60eee7e6284768b78d51dbed4a2913aa18dd.tar.bz2 rails-45ea60eee7e6284768b78d51dbed4a2913aa18dd.zip |
fewer method calls, fewer code branches
Diffstat (limited to 'activerecord/lib/active_record')
-rw-r--r-- | activerecord/lib/active_record/associations/class_methods/join_dependency/join_association.rb | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/activerecord/lib/active_record/associations/class_methods/join_dependency/join_association.rb b/activerecord/lib/active_record/associations/class_methods/join_dependency/join_association.rb index 09094f3ed5..25511a092f 100644 --- a/activerecord/lib/active_record/associations/class_methods/join_dependency/join_association.rb +++ b/activerecord/lib/active_record/associations/class_methods/join_dependency/join_association.rb @@ -79,17 +79,16 @@ module ActiveRecord def aliased_table_name_for(name, suffix = nil) aliases = @join_dependency.table_aliases - if !aliases[name].zero? # We need an alias + if aliases[name] != 0 # We need an alias connection = active_record.connection name = connection.table_alias_for "#{pluralize(reflection.name)}_#{parent_table_name}#{suffix}" - aliases[name] += 1 - table_index = aliases[name] + table_index = aliases[name] + 1 name = name[0, connection.table_alias_length-3] + "_#{table_index}" if table_index > 1 - else - aliases[name] += 1 end + aliases[name] += 1 + name end |