Module: Decidim::Comments::Export

Defined in:
decidim-comments/lib/decidim/comments/export.rb

Class Method Summary collapse

Class Method Details

.comments_for_resource(resource_class, feature) ⇒ Object

Public: Given a resource class and a feature, returns the comments for that resource in that feature.

resource_class - The resource’s Class feature - The feature where the resource is scoped to.

Returns an Arel::Relation with all the comments for that feature and resource.



13
14
15
16
17
# File 'decidim-comments/lib/decidim/comments/export.rb', line 13

def comments_for_resource(resource_class, feature)
  Comment
    .where(decidim_root_commentable_id: resource_class.where(feature: feature))
    .where(decidim_root_commentable_type: resource_class.to_s)
end