hidakatsuya/redmine_default_custom_query

View on GitHub
app/patches/models/query_patch.rb

Summary

Maintainability
A
0 mins
Test Coverage
require_dependency 'query'

module DefaultCustomQuery
  module QueryPatch
    extend ActiveSupport::Concern

    included do
      scope :only_public, -> { where(visibility: Query::VISIBILITY_PUBLIC) }
    end
  end
end

DefaultCustomQuery::QueryPatch.tap do |mod|
  Query.send :include, mod unless Query.include?(mod)
end