fix error with single cannot condition

This commit is contained in:
Yura Sokolov
2010-05-25 12:14:01 +04:00
parent dbc1538054
commit bcab8d6369
3 changed files with 47 additions and 20 deletions

View File

@@ -237,9 +237,9 @@ module CanCan
conds.reverse.inject(nil) do |sql, action|
behavior, condition = action
if condition && condition != {}
condition = "#{subject.send(:sanitize_sql, condition)}"
condition = subject.send(:sanitize_sql, condition)
case sql
when nil then condition
when nil then behavior ? condition : "not (#{condition})"
when true_cond
behavior ? true_cond : "not (#{condition})"
when false_cond