Sha256: 3a6a0be250d65b073ef2a384b2c14e5c7c9e3a753f89fd6fe1007a5b32b2a4e5

Contents?: true

Size: 767 Bytes

Versions: 2

Compression:

Stored size: 767 Bytes

Contents

require 'make_flaggable/flagging'
require 'make_flaggable/flaggable'
require 'make_flaggable/flagger'
require 'make_flaggable/exceptions'

module MakeFlaggable
  def flaggable?
    false
  end

  def flagger?
    false
  end

  # Specify a model as flaggable.
  # Optional option :once_per_flagger when only on flag per flagger is allowed.
  #
  # Example:
  # class Article < ActiveRecord::Base
  #   make_flaggable :once_per_flagger => true
  # end
  def make_flaggable
    include Flaggable
  end

  # Specify a model as flagger.
  #
  # Example:
  # class User < ActiveRecord::Base
  #   make_flagger
  # end
  def make_flagger(options = {})
    define_method(:flaggable_options) { options }
    include Flagger
  end
end

ActiveRecord::Base.extend MakeFlaggable

Version data entries

2 entries across 2 versions & 1 rubygems

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