Sha256: fe07454b0717e3361d6a191efafcf1e62e88f977efd5bffd9e05fcd92943dd94

Contents?: true

Size: 482 Bytes

Versions: 1

Compression:

Stored size: 482 Bytes

Contents

module CanTango
  class Ability
    mattr_accessor :orm, :strategy
    
    module ClassMethods
      # BAD!
      def orm= orm
        @orm = orm 
        set_strategy orm        
      end

      def set_strategy orm
        @strategy = relational_orm?(orm) ? :default : :string
      end
  
      private
  
      def relational_orm? orm
        relations_orms.include?(orm)
      end
  
      def relations_orms
        [:active_record, :generic]
      end
    end    
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
cantango-0.8.0 lib/cantango/ability/class_methods.rb