Class: Carbonyte::ApplicationPolicy

Inherits:
Object
  • Object
show all
Defined in:
app/policies/carbonyte/application_policy.rb

Overview

Carbonyte base class for all policies

Defined Under Namespace

Classes: Scope

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(user, record) ⇒ ApplicationPolicy

Initializes a new policy with the current user and the record



9
10
11
12
# File 'app/policies/carbonyte/application_policy.rb', line 9

def initialize(user, record)
  @user = user
  @record = record
end

Instance Attribute Details

#recordObject (readonly)

Returns the value of attribute record.



6
7
8
# File 'app/policies/carbonyte/application_policy.rb', line 6

def record
  @record
end

#userObject (readonly)

Returns the value of attribute user.



6
7
8
# File 'app/policies/carbonyte/application_policy.rb', line 6

def user
  @user
end

Instance Method Details

#create?Boolean

Can the user create a new record?

Returns:

  • (Boolean)


25
26
27
# File 'app/policies/carbonyte/application_policy.rb', line 25

def create?
  true
end

#destroy?Boolean

Can the user destroy this record?

Returns:

  • (Boolean)


35
36
37
# File 'app/policies/carbonyte/application_policy.rb', line 35

def destroy?
  true
end

#index?Boolean

Can the user get a list of records?

Returns:

  • (Boolean)


15
16
17
# File 'app/policies/carbonyte/application_policy.rb', line 15

def index?
  true
end

#show?Boolean

Can the user get this specific record?

Returns:

  • (Boolean)


20
21
22
# File 'app/policies/carbonyte/application_policy.rb', line 20

def show?
  true
end

#update?Boolean

Can the user update this record?

Returns:

  • (Boolean)


30
31
32
# File 'app/policies/carbonyte/application_policy.rb', line 30

def update?
  true
end