Skip to content

Commit 90cb2ed

Browse files
committed
Merge branch 'yhirano55-refactor_commit'
2 parents 986bada + 637dd18 commit 90cb2ed

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

app/models/commit.rb

+7-7
Original file line numberDiff line numberDiff line change
@@ -5,28 +5,28 @@ class Commit < ApplicationRecord
55

66
scope :with_no_contributors, -> {
77
select('commits.*'). # otherwise we get read-only records
8-
joins('LEFT OUTER JOIN contributions ON commits.id = contributions.commit_id').
9-
where('contributions.commit_id' => nil)
8+
left_joins(:contributions).
9+
where(contributions: { commit_id: nil })
1010
}
1111

1212
scope :in_time_window, ->(since, upto) {
1313
if upto
14-
where(['commits.committer_date BETWEEN ? AND ?', since, upto])
14+
where(committer_date: since..upto)
1515
else
16-
where(['commits.committer_date >= ?', since])
16+
where('commits.committer_date >= ?', since)
1717
end
1818
}
1919

2020
scope :release, ->(release) {
21-
where('commits.release_id' => release.id)
21+
where(release_id: release.id)
2222
}
2323

2424
scope :edge, -> {
25-
where('commits.release_id' => nil)
25+
where(release_id: nil)
2626
}
2727

2828
scope :sorted, -> {
29-
order('commits.committer_date DESC')
29+
order(committer_date: :desc)
3030
}
3131

3232
validates :sha1, presence: true, uniqueness: true

0 commit comments

Comments
 (0)