Skip to content

Commit

Permalink
fixed ambiguous column error (#434)
Browse files Browse the repository at this point in the history
  • Loading branch information
Denis Shevchenko authored and EppO committed Nov 20, 2017
1 parent dffb0f6 commit bf6b9a1
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/rolify/adapters/active_record/resource_adapter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def resources_find(roles_table, relation, role_name)

def in(relation, user, role_names)
roles = user.roles.where(:name => role_names).select("#{quote_table(role_class.table_name)}.#{quote_column(role_class.primary_key)}")
relation.where("#{quote_table(role_class.table_name)}.#{quote_column(role_class.primary_key)} IN (?) AND ((resource_id = #{quote_table(relation.table_name)}.#{quote_column(relation.primary_key)}) OR (resource_id IS NULL))", roles)
relation.where("#{quote_table(role_class.table_name)}.#{quote_column(role_class.primary_key)} IN (?) AND ((#{quote_table(role_class.table_name)}.resource_id = #{quote_table(relation.table_name)}.#{quote_column(relation.primary_key)}) OR (#{quote_table(role_class.table_name)}.resource_id IS NULL))", roles)
end

def applied_roles(relation, children)
Expand Down

0 comments on commit bf6b9a1

Please sign in to comment.