Sha256: 54288299f193096e61147440a78bd46fcbdd8b044564bc38c16bb3be6676fd85

Contents?: true

Size: 552 Bytes

Versions: 10

Compression:

Stored size: 552 Bytes

Contents

module Flipper
  module Model
    module ActiveRecord
      # The id of the record when used as an actor.
      #
      #   class User < ActiveRecord::Base
      #   end
      #
      #   user = User.first
      #   Flipper.enable :some_feature, user
      #   Flipper.enabled? :some_feature, user #=> true
      #
      def flipper_id
        "#{self.class.base_class.name};#{id}"
      end

      # Properties used to evaluate expressions
      def flipper_properties
        {"type" => self.class.name}.merge(attributes)
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 2 rubygems

Version Path
flipper-1.3.2 lib/flipper/model/active_record.rb
flipper-1.3.1 lib/flipper/model/active_record.rb
flipper-1.3.0 lib/flipper/model/active_record.rb
flipper-1.3.0.pre lib/flipper/model/active_record.rb
flipper-1.2.2 lib/flipper/model/active_record.rb
flipper-1.2.1 lib/flipper/model/active_record.rb
flipper-1.2.0 lib/flipper/model/active_record.rb
flipper-1.1.2 lib/flipper/model/active_record.rb
flipper-1.1.1 lib/flipper/model/active_record.rb
flipper-active_record-1.1.0 lib/flipper/model/active_record.rb