diff options
author | Lin Jen-Shin <godfat@godfat.org> | 2016-07-07 18:56:02 +0800 |
---|---|---|
committer | Lin Jen-Shin <godfat@godfat.org> | 2016-07-07 18:56:02 +0800 |
commit | b988644ad853ea00ed23bfc57f83883f96a12016 (patch) | |
tree | 6f50ca2312592e7e5c2040b7f3ba997ca5404ab6 | |
parent | 3c89a788c795fba2b050a0af0d8261e302d8cded (diff) | |
download | gitlab-ce-b988644ad853ea00ed23bfc57f83883f96a12016.tar.gz |
Use scope rather than class methodprefer-scope
-rw-r--r-- | app/models/ci/build.rb | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/app/models/ci/build.rb b/app/models/ci/build.rb index 5c973749975..e189dbac285 100644 --- a/app/models/ci/build.rb +++ b/app/models/ci/build.rb @@ -13,6 +13,7 @@ module Ci scope :ignore_failures, ->() { where(allow_failure: false) } scope :with_artifacts, ->() { where.not(artifacts_file: nil) } scope :with_expired_artifacts, ->() { with_artifacts.where('artifacts_expire_at < ?', Time.now) } + scope :last_month, ->() { where('created_at > ?', Date.today - 1.month) } mount_uploader :artifacts_file, ArtifactUploader mount_uploader :artifacts_metadata, ArtifactUploader @@ -25,10 +26,6 @@ module Ci after_create :execute_hooks class << self - def last_month - where('created_at > ?', Date.today - 1.month) - end - def first_pending pending.unstarted.order('created_at ASC').first end |