This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# implementation from https://github.com/rails/rails/pull/16919 | |
# activerecord/lib/active_record/connection_adapters/postgresql/oid/interval.rb | |
require "active_support/duration" | |
module ActiveRecord | |
module ConnectionAdapters | |
module PostgreSQL |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |