Class: CafeCar::ApplicationPolicy

Inherits:
Object
  • Object
show all
Includes:
Policy
Defined in:
app/policies/cafe_car/application_policy.rb

Defined Under Namespace

Classes: Attributes, Scope

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Policy

#association_for_attribute, #displayable_associations, #displayable_attribute?, #displayable_attributes, #editable_attributes, #filtered_attribute?, #info, #listable_attributes, #logo_attribute, #model, #permitted_association?, #permitted_attribute?, #permitted_attribute_keys, #permitted_fields, #policy, #title_attribute

Constructor Details

#initialize(user, object) ⇒ ApplicationPolicy

Returns a new instance of ApplicationPolicy.



8
9
10
11
# File 'app/policies/cafe_car/application_policy.rb', line 8

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

Instance Attribute Details

#objectObject (readonly)

Returns the value of attribute object.



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

def object
  @object
end

#userObject (readonly)

Returns the value of attribute user.



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

def user
  @user
end

Instance Method Details

#attributesObject



21
22
23
# File 'app/policies/cafe_car/application_policy.rb', line 21

def attributes
  @attributes ||= Attributes.new(@user, @object, permitted_attributes)
end

#create?Boolean

Returns:

  • (Boolean)


15
# File 'app/policies/cafe_car/application_policy.rb', line 15

def create?  = false

#destroy?Boolean

Returns:

  • (Boolean)


19
# File 'app/policies/cafe_car/application_policy.rb', line 19

def destroy? = false

#edit?Boolean

Returns:

  • (Boolean)


18
# File 'app/policies/cafe_car/application_policy.rb', line 18

def edit?    = update?

#index?Boolean

Returns:

  • (Boolean)


13
# File 'app/policies/cafe_car/application_policy.rb', line 13

def index?   = false

#new?Boolean

Returns:

  • (Boolean)


16
# File 'app/policies/cafe_car/application_policy.rb', line 16

def new?     = create?

#show?Boolean

Returns:

  • (Boolean)


14
# File 'app/policies/cafe_car/application_policy.rb', line 14

def show?    = false

#update?Boolean

Returns:

  • (Boolean)


17
# File 'app/policies/cafe_car/application_policy.rb', line 17

def update?  = false