hubfeenix.fi/app/policies/edit_own_policy.rb

11 lines
224 B
Ruby
Raw Normal View History

2023-01-16 00:11:05 +01:00
# allows to edit/detroy own data
# which can be viewed by anyone
class EditOwnPolicy < ApplicationPolicy
def edit?
(member == record.member) or member.admin?
end
alias :update? :edit?
alias :destroy? :edit?
end