module Allowed::Limit::ClassMethods

Public Instance Methods

allow(limit, options = {}, &block) click to toggle source
# File lib/allowed/limit.rb, line 10
def allow(limit, options = {}, &block)
  if block_given?
    options[:callback] = block
  end

  self._throttles ||= []
  self._throttles  << Throttle.new(limit, options)

  validate :validate_throttles, on: :create

  after_rollback :handle_throttles, on: :create
end