The code powering m.abunchtell.com https://m.abunchtell.com
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

23 lines
410 B

  1. # frozen_string_literal: true
  2. class ApplicationPolicy
  3. attr_reader :current_account, :record
  4. def initialize(current_account, record)
  5. @current_account = current_account
  6. @record = record
  7. end
  8. delegate :admin?, :moderator?, :staff?, to: :current_user, allow_nil: true
  9. private
  10. def current_user
  11. current_account&.user
  12. end
  13. def user_signed_in?
  14. !current_user.nil?
  15. end
  16. end