Sha256: 66dbbb4a03c9de77f71f79f14257478486976eb9bae6c9685e826b7d90e07a27

Contents?: true

Size: 721 Bytes

Versions: 56

Compression:

Stored size: 721 Bytes

Contents

# frozen_string_literal: true

module Decidim
  module Comments
    module Export
      # 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.
      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

      module_function :comments_for_resource
    end
  end
end

Version data entries

56 entries across 56 versions & 2 rubygems

Version Path
decidim-comments-0.10.1 lib/decidim/comments/export.rb
decidim-comments-0.10.0 lib/decidim/comments/export.rb
decidim-comments-0.9.3 lib/decidim/comments/export.rb
decidim-comments-0.9.2 lib/decidim/comments/export.rb
decidim-comments-0.9.1 lib/decidim/comments/export.rb
decidim-comments-0.9.0 lib/decidim/comments/export.rb
decidim-comments-0.8.4 lib/decidim/comments/export.rb
decidim-comments-0.8.3 lib/decidim/comments/export.rb
decidim-comments-0.8.2 lib/decidim/comments/export.rb
decidim-comments-0.8.1 lib/decidim/comments/export.rb
decidim-comments-0.8.0 lib/decidim/comments/export.rb
decidim-comments-0.7.4 lib/decidim/comments/export.rb
decidim-comments-0.7.3 lib/decidim/comments/export.rb
decidim-comments-0.7.2 lib/decidim/comments/export.rb
decidim-comments-0.7.1 lib/decidim/comments/export.rb
decidim-comments-0.7.0 lib/decidim/comments/export.rb
decidim-comments-0.6.8 lib/decidim/comments/export.rb
decidim-0.6.8 decidim-comments/lib/decidim/comments/export.rb
decidim-comments-0.6.7 lib/decidim/comments/export.rb
decidim-0.6.7 decidim-comments/lib/decidim/comments/export.rb