Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed page listing error: comparison of Fixnum with nil failed #3308

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

bofrede
Copy link
Contributor

@bofrede bofrede commented Aug 15, 2017

When browsing at http://localhost:3000/refinery/pages
Pages translated to locales not mentioned in the Refinery::I18n.frontend_locales causes:

ArgumentError in Refinery::Admin::Pages#index
Showing .../refinerycms-pages-3.0.5/app/views/refinery/admin/pages/_page.html.erb where line #28 raised:
comparison of Fixnum with nil failed

This happens if you start translating into a language, but remove the locale from Refinery::I18n.frontend_locales if it is not ready at launch.

When browsing at http://localhost:3000/refinery/pages
Pages translated to locales not mentioned in the Refinery::I18n.frontend_locales causes:
```
ArgumentError in Refinery::Admin::Pages#index
Showing .../refinerycms-pages-3.0.5/app/views/refinery/admin/pages/_page.html.erb where line refinery#28 raised:
comparison of Fixnum with nil failed
```
This happens if you start translating into a language, but remove the locale from Refinery::I18n.frontend_locales if it is not ready at launch.
@@ -25,7 +25,7 @@

<% if Refinery::I18n.frontend_locales.many? %>
<span class='locales'>
<% page.translations.sort_by{ |t| Refinery::I18n.frontend_locales.index(t.locale)}.each do |translation| %>
<% page.translations.sort_by{ |t| Refinery::I18n.locales.index(t.locale)}.each do |translation| %>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like this change but we should really change the locale switcher the way we add the locales edit links. Perhaps we should create a presenter. Thoughts @parndt ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would also be nice if the webmaster could add and remove frontend languages, without requiring a deployment.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure if we want this, perhaps it's a good idea to ask a dev if we can add/remove a frontend language.

@parndt
Copy link
Member

parndt commented Aug 16, 2017

Is it possible to have a test case for this patch please?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants