Last active
August 29, 2015 14:05
-
-
Save Austio/1bac0bf50445d2b3806e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
app/policies/court_policy.rb | |
``` | |
class CourtPolicy < ApplicationPolicy | |
attr_reader :user, :record | |
def initialize(user, record) | |
@user = user | |
@record = record | |
end | |
def index? | |
user.has_role? :admin | |
end | |
end | |
``` | |
app/policies/application_policy.rb | |
``` | |
class ApplicationPolicy | |
attr_reader :user, :record | |
def initialize(user, record) | |
@user = user | |
@record = record | |
end | |
def index? | |
false | |
end | |
end | |
``` | |
app/controllers/application_controller.rb | |
``` | |
class ApplicationController < ActionController::Base | |
include Pundit | |
end | |
``` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment