Sha256: 9fc04195927054ce1af8ebfeec4e13f382f144b4c07327bd8f539e4892eee195

Contents?: true

Size: 392 Bytes

Versions: 1

Compression:

Stored size: 392 Bytes

Contents

module MakeFlaggable
  module Flaggable
    extend ActiveSupport::Concern

    included do
      has_many :flaggings, :class_name => "MakeFlaggable::Flagging", :as => :flaggable
    end

    module ClassMethods
      def flaggable?
        true
      end
    end

    def flagged?
      flaggings.count > 0
    end

    def flagged_by?(flagger)
      flagger.flagged?(self)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
make_flaggable-0.0.3 lib/make_flaggable/flaggable.rb