Welcome to mirror list, hosted at ThFree Co, Russian Federation.

updated_at_filterable.rb « concerns « models « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 1ab5ee9fbb9a353d60cdfd1e795a009872aff5ee (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
# frozen_string_literal: true

module UpdatedAtFilterable
  extend ActiveSupport::Concern

  included do
    scope :updated_before, ->(date) { where(scoped_table[:updated_at].lteq(date)) }
    scope :updated_after, ->(date) { where(scoped_table[:updated_at].gteq(date)) }

    def self.scoped_table
      arel_table.alias(table_name)
    end
  end
end