Sha256: 7c617aa651cd2ee6d48dbcfc633673b48bf6bd9773d13eeaf8c653ec7a6f0819

Contents?: true

Size: 470 Bytes

Versions: 21

Compression:

Stored size: 470 Bytes

Contents

# ensures compatibility with CanCan 1.5+ and 1.4-
module CanTango
  class PermitEngine < Engine
    module Compatibility
      def rules
        return rules_1_5 if rules_1_5
        return rules_1_4 if rules_1_4
        raise "CanCan ability.rules could not be found. Possibly due to CanCan API change since 1.5"
      end

      def rules_1_5
        ability.send :rules
      end

      def rules_1_4
        ability.send :can_definitions
      end
    end
  end
end

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
cantango-0.8.5.1 lib/cantango/permit_engine/compatibility.rb