Flowdock
method

count_aliases_from_table_joins

Importance_0
v3.0.5 - Show latest stable - 0 notes - Class: ActiveRecord::Associations::ClassMethods::JoinDependency
count_aliases_from_table_joins(name) public

No documentation

This method has no description. You can help the Ruby on Rails community by adding new notes.

Hide source
# File activerecord/lib/active_record/associations.rb, line 1872
          def count_aliases_from_table_joins(name)
            # quoted_name should be downcased as some database adapters (Oracle) return quoted name in uppercase
            quoted_name = join_base.active_record.connection.quote_table_name(name.downcase).downcase
            join_sql = join_base.table_joins.to_s.downcase
            join_sql.blank? ? 0 :
              # Table names
              join_sql.scan(/join(?:\s+\w+)?\s+#{quoted_name}\son/).size +
              # Table aliases
              join_sql.scan(/join(?:\s+\w+)?\s+\S+\s+#{quoted_name}\son/).size
          end
Register or log in to add new notes.