Class: ProfilePolicy

Inherits:
ApplicationPolicy show all
Defined in:
app/policies/profile_policy.rb

Defined Under Namespace

Classes: Scope

Instance Attribute Summary

Attributes inherited from ApplicationPolicy

#record, #user

Instance Method Summary collapse

Methods inherited from ApplicationPolicy

#create?, #destroy?, #index?, #initialize, #new?, #scope

Constructor Details

This class inherits a constructor from ApplicationPolicy

Instance Method Details

#edit?Boolean

Returns:

  • (Boolean)

5
# File 'app/policies/profile_policy.rb', line 5

def edit?           ; belongs_to_current_user?                                                        ; end

#show?Boolean

Returns:

  • (Boolean)

3
# File 'app/policies/profile_policy.rb', line 3

def show?           ; belongs_to_current_user? or (record.privacy == 0 and not record.username.nil?)  ; end

#update?Boolean

Returns:

  • (Boolean)

4
# File 'app/policies/profile_policy.rb', line 4

def update?         ; belongs_to_current_user?                                                        ; end