Skip to content

Commit

Permalink
[api] Use superseding.last instead of index
Browse files Browse the repository at this point in the history
We want a comma except for the last record, because of that I think that
it is more readable to use `superseding.last` than using an index and
comparing it with `superseding.length - 1`. This way we also don't need
to use `each_with_index`, as we don't really care of what index every
record have.

This may be a matter of taste, but I find it more elegant.
  • Loading branch information
Ana06 committed Jun 22, 2018
1 parent 4cebe3b commit 4a5709f
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
.ui-state-info.ui-corner-all.ui-widget-shadow.padding-10pt#request-supersedes-hint
%span.ui-icon.ui-icon-info
This request supersedes:
- superseding.each_with_index do |bs_request, index|
- superseding.each do |bs_request|
= link_to "request #{bs_request.number}", request_show_path(number: bs_request.number)
= surround '(', ")#{', ' if index < superseding.length - 1 }" do
= surround '(', ")#{', ' unless bs_request == superseding.last }" do
= link_to('Show diff', request_show_path(number: bs_request.superseded_by, diff_to_superseded: bs_request.number))
- if superseded_by.present?
.grid_16.alpha.omega.box-invisible
Expand Down

0 comments on commit 4a5709f

Please sign in to comment.