blob: a1f46478b6f3182e87954d4045344e46ed3fc72e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
# frozen_string_literal: true
module CreatedAtFilterable
extend ActiveSupport::Concern
included do
scope :created_before, ->(date) { where(scoped_table[:created_at].lteq(date)) }
scope :created_after, ->(date) { where(scoped_table[:created_at].gteq(date)) }
def self.scoped_table
arel_table.alias(table_name)
end
end
end
|