setting_policy.rb 257 B

123456789101112131415161718
  1. class SettingPolicy < ApplicationPolicy
  2. def show?
  3. permitted?
  4. end
  5. def update?
  6. permitted?
  7. end
  8. private
  9. def permitted?
  10. return true if !record.preferences[:permission]
  11. user.permissions?(record.preferences[:permission])
  12. end
  13. end