Sha256: 28ca44010359a429e0c2705413dcf4c98eaa7822fcf66e206a8fc1206f79740a

Contents?: true

Size: 559 Bytes

Versions: 2

Compression:

Stored size: 559 Bytes

Contents

module AdvertSelector
  class ApplicationController < ActionController::Base

    before_action :admin_access_only
    before_action :set_time_zone
    before_action :set_locale

    def admin_access_only
      if AdvertSelector.admin_access_class.send(:admin_access, self)
        return true
      else
        render :plain => "Forbidden, only for admins", :status => 403
        return false
      end
    end

    def set_time_zone
      Time.zone = AdvertSelector.default_time_zone
    end

    def set_locale
      I18n.locale = :en
    end

  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
advert_selector-3.0.1 app/controllers/advert_selector/application_controller.rb
advert_selector-3.0.0 app/controllers/advert_selector/application_controller.rb