Class: ActiveAdmin::Comments::Views::Comments

Inherits:
Views::Panel show all
Defined in:
lib/active_admin/orm/active_record/comments/views/active_admin_comments.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Views::Panel

#add_child, #children?, #header_action

Instance Attribute Details

#resourceObject

Returns the value of attribute resource.



12
13
14
# File 'lib/active_admin/orm/active_record/comments/views/active_admin_comments.rb', line 12

def resource
  @resource
end

Instance Method Details

#build(resource) ⇒ Object



14
15
16
17
18
19
20
21
# File 'lib/active_admin/orm/active_record/comments/views/active_admin_comments.rb', line 14

def build(resource)
  if authorized?(ActiveAdmin::Auth::READ, ActiveAdmin::Comment)
    @resource = resource
    @comments = active_admin_authorization.scope_collection(ActiveAdmin::Comment.find_for_resource_in_namespace(resource, active_admin_namespace.name).includes(:author).page(params[:page]))
    super(title, for: resource)
    build_comments
  end
end