Sha256: 63f4bc8426477e6bc86fac161e4a14d2a65966137c73debc6c10c31addffd0c2

Contents?: true

Size: 697 Bytes

Versions: 6

Compression:

Stored size: 697 Bytes

Contents

module Pageflow
  module QuotaVerification
    extend ActiveSupport::Concern

    included do
      rescue_from Quota::ExhaustedError do |exception|
        respond_to do |format|
          format.html do
            redirect_to :back, :alert => t('quotas.exhausted')
          end
          format.json do
            render(:status => :forbidden,
                   :json => {
                     :error_message => exception.message,
                     :quota_name => exception.quota.name
                   })
          end
        end
      end
    end

    protected

    def verify_quota!(name, account)
      Pageflow.config.quotas.get(name, account).verify_available!
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
pageflow-0.6.0 app/controllers/concerns/pageflow/quota_verification.rb
pageflow-0.5.0 app/controllers/concerns/pageflow/quota_verification.rb
pageflow-0.4.0 app/controllers/concerns/pageflow/quota_verification.rb
pageflow-0.3.0 app/controllers/concerns/pageflow/quota_verification.rb
pageflow-0.2.1 app/controllers/concerns/pageflow/quota_verification.rb
pageflow-0.2.0 app/controllers/concerns/pageflow/quota_verification.rb