Sha256: f149fc51e633086d7e5fc742d9c0710213d354c7aaa3af4305edcf18add483db

Contents?: true

Size: 783 Bytes

Versions: 21

Compression:

Stored size: 783 Bytes

Contents

# frozen_string_literal: true

module PaidUp
  # PaidUp Controller
  class PaidUpController < ApplicationController
    helper :all

    before_action :set_locale
    before_action :warn_if_delinquent

    private

    def set_locale
      I18n.locale = params[:locale] || I18n.default_locale
    end

    def warn_if_delinquent
      return unless delinquent? &&
                    params[:controller] != 'paid_up/subscriptions'
      flash[:error] = :account_is_delinquent.l +
                      :to_disable_this_message_subscribe.l(
                        subscribe_link: paid_up.plans_path
                      )
    end

    def delinquent?
      user_signed_in? && (
        current_user.plan.nil? ||
        current_user.stripe_data.delinquent
      )
    end
  end
end

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
paid_up-0.13.22 app/controllers/paid_up/paid_up_controller.rb
paid_up-0.13.21 app/controllers/paid_up/paid_up_controller.rb
paid_up-0.13.17 app/controllers/paid_up/paid_up_controller.rb
paid_up-0.13.16 app/controllers/paid_up/paid_up_controller.rb
paid_up-0.13.14 app/controllers/paid_up/paid_up_controller.rb
paid_up-0.13.13 app/controllers/paid_up/paid_up_controller.rb
paid_up-0.13.12 app/controllers/paid_up/paid_up_controller.rb
paid_up-0.13.11 app/controllers/paid_up/paid_up_controller.rb
paid_up-0.13.10 app/controllers/paid_up/paid_up_controller.rb
paid_up-0.13.9 app/controllers/paid_up/paid_up_controller.rb
paid_up-0.13.8 app/controllers/paid_up/paid_up_controller.rb
paid_up-0.13.7 app/controllers/paid_up/paid_up_controller.rb
paid_up-0.13.6 app/controllers/paid_up/paid_up_controller.rb
paid_up-0.13.5 app/controllers/paid_up/paid_up_controller.rb
paid_up-0.13.4 app/controllers/paid_up/paid_up_controller.rb
paid_up-0.13.3 app/controllers/paid_up/paid_up_controller.rb
paid_up-0.13.2 app/controllers/paid_up/paid_up_controller.rb
paid_up-0.13.1 app/controllers/paid_up/paid_up_controller.rb
paid_up-0.13.0 app/controllers/paid_up/paid_up_controller.rb
paid_up-0.12.4 app/controllers/paid_up/paid_up_controller.rb