Skip to content

Instantly share code, notes, and snippets.

@vollnhals
vollnhals / gist:4031511
Created November 7, 2012 13:11 — forked from rafakuch/gist:3842277
Possible solution for CanCan Issue #646?
# overwrite conditions method to work on rails >= 3.2.6
class CanCan::ModelAdapters::ActiveRecordAdapter
def conditions
if @rules.size == 1 && @rules.first.base_behavior
# Return the conditions directly if there's just one definition
dig(tableized_conditions(@rules.first.conditions).dup)
else