1# frozen_string_literal: true 2 3module ClosedAtFilterable 4 extend ActiveSupport::Concern 5 6 included do 7 scope :closed_before, ->(date) { where(scoped_table[:closed_at].lteq(date)) } 8 scope :closed_after, ->(date) { where(scoped_table[:closed_at].gteq(date)) } 9 10 def self.scoped_table 11 arel_table.alias(table_name) 12 end 13 end 14end 15