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

created_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: e8a3e41203d80599620a3c178ce529038034823e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
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