Fixed issue #2418 - Missing table name quoting causes MySQL 8 incompatibility.

This commit is contained in:
Thorsten Eckel 2018-12-29 23:07:11 +01:00
parent b361b43836
commit 3d45432f78
2 changed files with 2 additions and 2 deletions

View file

@ -134,7 +134,7 @@ returns
next if association_attributes_ignored.include?(assoc_name)
eager_load.push(assoc_name)
pluck.push("#{assoc.table_name}.id AS #{assoc_name}")
pluck.push("#{ActiveRecord::Base.connection.quote_table_name(assoc.table_name)}.id AS #{ActiveRecord::Base.connection.quote_table_name(assoc_name)}")
keys.push("#{assoc_name.to_s.singularize}_ids")
end

View file

@ -38,7 +38,7 @@ module HasGroups
# @return [ActiveRecord::AssociationRelation<[<Group]>] List of Groups with :through attributes
def access(*access)
table_name = proxy_association.owner.class.group_through.table_name
query = select("groups.*, #{table_name}.*")
query = select("#{ActiveRecord::Base.connection.quote_table_name('groups')}.*, #{ActiveRecord::Base.connection.quote_table_name(table_name)}.*")
return query if access.blank?
access.push('full') if !access.include?('full')