Skip to content

Commit

Permalink
Inline methods
Browse files Browse the repository at this point in the history
  • Loading branch information
johnnyshields committed Jul 31, 2022
1 parent 340db2c commit c8b3bb4
Showing 1 changed file with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions lib/cancancan/model_adapters/mongoid_adapter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,8 @@ def database_records_from_multiple_rules
can_conditions, cannot_conditions = extract_conditions_from_rules

scope = @model_class.all

if can_conditions.any?
scope = scope.where('$or' => can_conditions)
end

if cannot_conditions.any?
scope = scope.where('$nor' => cannot_conditions)
end

scope = scope.where('$or' => can_conditions) if can_conditions.any?
scope = scope.where('$nor' => cannot_conditions) if cannot_conditions.any?
scope
end

Expand Down

0 comments on commit c8b3bb4

Please sign in to comment.