Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Debian packages RPM packages NuGet packages

Repository URL to install this package:

Details    
discourse-annotator / app / models / concerns / topic_annotatable.rb
Size: Mime:
module TopicAnnotatable
  extend ActiveSupport::Concern
  included do

    has_many :annotations, through: :posts

  end
end

# scope :with_annotations, -> {includes(posts: :annotations).where.not(discourse_annotator_annotations: {id: nil})}

# def self.with_annotations_count
#   select("topics.*, count(posts.id) AS annotations_count")
#       .joins("LEFT OUTER JOIN (#{Post.with_annotations_count.to_sql}) posts ON topics.id = posts.topic_id")
#       .group('topics.id')
#       .order("annotations_count DESC")
# end