Class: Ckeditor::AttachmentFilePolicy

Inherits:
ApplicationPolicy
  • Object
show all
Defined in:
lib/generators/ckeditor/templates/action_policy/attachment_file_policy.rb,
lib/generators/ckeditor/templates/pundit_policy/attachment_file_policy.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(user, attachment) ⇒ AttachmentFilePolicy

Returns a new instance of AttachmentFilePolicy.



6
7
8
9
# File 'lib/generators/ckeditor/templates/pundit_policy/attachment_file_policy.rb', line 6

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

Instance Attribute Details

#attachmentObject (readonly)

Returns the value of attribute attachment.



4
5
6
# File 'lib/generators/ckeditor/templates/pundit_policy/attachment_file_policy.rb', line 4

def attachment
  @attachment
end

#userObject (readonly)

Returns the value of attribute user.



4
5
6
# File 'lib/generators/ckeditor/templates/pundit_policy/attachment_file_policy.rb', line 4

def user
  @user
end

Instance Method Details

#create?Boolean

Returns:

  • (Boolean)


11
12
13
# File 'lib/generators/ckeditor/templates/action_policy/attachment_file_policy.rb', line 11

def create?
  user.present?
end

#destroy?Boolean

Returns:

  • (Boolean)


15
16
17
# File 'lib/generators/ckeditor/templates/action_policy/attachment_file_policy.rb', line 15

def destroy?
  user.present?
end

#index?Boolean

Returns:

  • (Boolean)


7
8
9
# File 'lib/generators/ckeditor/templates/action_policy/attachment_file_policy.rb', line 7

def index?
  user.present?
end