module Decidim::Comments::Export
Public Class Methods
comments_for_resource(resource_class, component)
click to toggle source
Public: Given a resource class and a component, returns the comments for that resource in that component.
resource_class - The resource's Class component - The component where the resource is scoped to.
Returns an Arel::Relation with all the comments for that component and resource.
# File lib/decidim/comments/export.rb, line 13 def comments_for_resource(resource_class, component) Comment .where(decidim_root_commentable_id: resource_class.where(component: component)) .where(decidim_root_commentable_type: resource_class.to_s) end
Private Instance Methods
comments_for_resource(resource_class, component)
click to toggle source
Public: Given a resource class and a component, returns the comments for that resource in that component.
resource_class - The resource's Class component - The component where the resource is scoped to.
Returns an Arel::Relation with all the comments for that component and resource.
# File lib/decidim/comments/export.rb, line 13 def comments_for_resource(resource_class, component) Comment .where(decidim_root_commentable_id: resource_class.where(component: component)) .where(decidim_root_commentable_type: resource_class.to_s) end