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

Inherits:
Arbre::Element
  • Object
show all
Defined in:
lib/active_admin/orm/active_record/comments/views/active_admin_comments.rb

Instance Method Summary collapse

Instance Method Details

#build(resource) ⇒ Object



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

def build(resource)
  if authorized?(ActiveAdmin::Auth::READ, ActiveAdmin::Comment)
    comments = active_admin_authorization.scope_collection(ActiveAdmin::Comment.find_for_resource_in_namespace(resource, active_admin_namespace.name).includes(:author).page(params[:page]))
    render("active_admin/shared/resource_comments", resource: resource, comments: comments, comment_form_url: comment_form_url)
  end
end