creddit/app/policies/subcreddit_policy.rb

18 lines
223 B
Ruby

# policies/subcreddit_policy.rb
class SubcredditPolicy < ApplicationPolicy
def index?
true
end
def show?
true
end
def create?
user.registered?
end
def update?
record.owner == user
end
end