diff options
Diffstat (limited to 'app/models/compare.rb')
-rw-r--r-- | app/models/compare.rb | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/app/models/compare.rb b/app/models/compare.rb index 2eaaf98c260..f1b0bf19c11 100644 --- a/app/models/compare.rb +++ b/app/models/compare.rb @@ -25,6 +25,16 @@ class Compare @straight = straight end + # Return a Hash of parameters for passing to a URL helper + # + # See `namespace_project_compare_url` + def to_param + { + from: @straight ? start_commit_sha : base_commit_sha, + to: head_commit_sha + } + end + def cache_key [@project, :compare, diff_refs.hash] end |