Sha256: 005e58b223db40b413db9492f6a2b38320b49f1862d53e1004b4a0318c3f428b

Contents?: true

Size: 340 Bytes

Versions: 8

Compression:

Stored size: 340 Bytes

Contents

class Admin::BaseController < ApplicationController
  before_filter :authenticate_as_admin

private
  def authenticate_as_admin
    unless user_is_an_admin?
      redirect_to root_path, alert: 'You must first login as an admin to do that!'
    end
  end

  def user_is_an_admin?
    current_user && current_user.has_role?(:admin)
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
rails-replicator-0.1.7 templates/admin_base_controller.rb
rails-replicator-0.1.6 templates/admin_base_controller.rb
rails-replicator-0.1.5 templates/admin_base_controller.rb
rails-replicator-0.1.4 templates/admin_base_controller.rb
rails-replicator-0.1.3 templates/admin_base_controller.rb
rails-replicator-0.1.2 templates/admin_base_controller.rb
rails-replicator-0.1.1 templates/admin_base_controller.rb
rails-replicator-0.1.0 templates/admin_base_controller.rb