From 27cb1768e7c1c49e112dcbb32931c61fa4c81293 Mon Sep 17 00:00:00 2001 From: Taico Aerts Date: Wed, 23 Feb 2022 11:58:08 +0100 Subject: [PATCH] Let rails figure out which fields to select Fixes #579 --- lib/rolify/adapters/active_record/resource_adapter.rb | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/rolify/adapters/active_record/resource_adapter.rb b/lib/rolify/adapters/active_record/resource_adapter.rb index c3dee94f..b1c5a213 100644 --- a/lib/rolify/adapters/active_record/resource_adapter.rb +++ b/lib/rolify/adapters/active_record/resource_adapter.rb @@ -21,7 +21,6 @@ def resources_find(roles_table, relation, role_name) resources = relation.joins("INNER JOIN #{quote_table(roles_table)} ON #{quote_table(roles_table)}.resource_type IN (#{relations}) AND (#{quote_table(roles_table)}.resource_id IS NULL OR #{quote_table(roles_table)}.resource_id = #{quote_table(relation.table_name)}.#{quote_column(relation.primary_key)})") resources = resources.where("#{quote_table(roles_table)}.name IN (?) AND #{quote_table(roles_table)}.resource_type IN (?)", Array(role_name), klasses) - resources = resources.select("#{quote_table(relation.table_name)}.*") resources end