diff options
author | Douwe Maan <douwe@selenight.nl> | 2017-04-07 01:13:28 +0300 |
---|---|---|
committer | Douwe Maan <douwe@selenight.nl> | 2017-04-08 22:37:46 +0300 |
commit | 50eae640dbbfa42a42e8b6966bd739cfda3adabc (patch) | |
tree | 1471ce67569d038e64a7e6f616d0d24be945aab9 /app/models/merge_request_diff.rb | |
parent | f47b737456f848784fddb5958c3fa781d2ede2f1 (diff) |
Fix specs and make tweaks
Diffstat (limited to 'app/models/merge_request_diff.rb')
-rw-r--r-- | app/models/merge_request_diff.rb | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/app/models/merge_request_diff.rb b/app/models/merge_request_diff.rb index bf9289086f0..3a26b4ee401 100644 --- a/app/models/merge_request_diff.rb +++ b/app/models/merge_request_diff.rb @@ -26,12 +26,15 @@ class MergeRequestDiff < ActiveRecord::Base end scope :viewable, -> { without_state(:empty) } - scope :with_diff_refs, ->(diff_refs) { where(start_commit_sha: diff_refs.start_sha, head_commit_sha: diff_refs.head_sha, base_commit_sha: diff_refs.base_sha) } # All diff information is collected from repository after object is created. # It allows you to override variables like head_commit_sha before getting diff. after_create :save_git_content, unless: :importing? + def self.find_by_diff_refs(diff_refs) + where(start_commit_sha: diff_refs.start_sha, head_commit_sha: diff_refs.head_sha, base_commit_sha: diff_refs.base_sha) + end + def self.select_without_diff select(column_names - ['st_diffs']) end |