Skip to content
This repository has been archived by the owner on Dec 12, 2021. It is now read-only.

Issue with accessible_by and ActiveRecord SQL JOIN behavior #1002

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .rvmrc

This file was deleted.

3 changes: 2 additions & 1 deletion lib/cancan/model_adapters/active_record_adapter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,8 @@ def database_records
elsif @model_class.respond_to?(:where) && @model_class.respond_to?(:joins)
mergeable_conditions = @rules.select {|rule| rule.unmergeable? }.blank?
if mergeable_conditions
@model_class.where(conditions).joins(joins)
#@model_class.where(conditions).joins(joins)
@model_class.where(conditions).includes(joins)
else
@model_class.where(*(@rules.map(&:conditions))).joins(joins)
end
Expand Down