# frozen_string_literal: true module Care::AutoFinder module FinderMethods extend ActiveSupport::Concern included do include Care::AutoFinder::Paginateble include Care::AutoFinder::Searchable include Care::AutoFinder::Sortable include Care::AutoFinder::ByIds end def range_filter(options) options = Struct.new(*options.keys).new(*options.values) if options.start.present? && options.end.present? options.collection.where(options.column => options.start..options.end) elsif options.start.present? options.collection.where("#{options.column} >= ?", options.start) elsif options.end.present? options.collection.where("#{options.column} <= ?", options.end) else options.collection end end end end