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