Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Issue:
'Pages' list doesn't work in the admin area.
Error description:
ActionView::Template::Error (comparison of Fixnum with nil failed):
25:
26: <% if Refinery::I18n.frontend_locales.many? %>
27:
28: <% page.translations.sort_by{ |t| Refinery::I18n.frontend_locales.index(t.locale)}.each do |translation| %>
29: <% if translation.title.present? %>
30: <%= link_to refinery.admin_edit_page_path(page.nested_url, switch_locale: translation.locale),
31: class: 'locale', title: translation.locale.upcase do %>
app/views/refinery/admin/pages/_page.html.erb:28
How to reproduce:
config.frontend_locales = [:a, :b]
config.frontend_locales = [:a]
Cause:
Refinery tries to sort page translations based on their locale's position in frontend_locales array.
Once locale is removed, sort tries to compare nil as position index with a Fixnum.