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

Fix scope i18n for 'all' scope #637

Merged
merged 1 commit into from
Oct 21, 2011

Conversation

felixbuenemann
Copy link
Contributor

When using active_admin's i18n for scopes and the 'all' scope is included on a resource, scope.scope_method is nil and so the i18n scope resolves to '.active_admin.scopes', which outputs the hash of all keys under this i18n key.

The fix falls back to the key active_admin.scopes.all, if the scope_method is not set.

See also this post on the mailing list from another user, that describes the problem and ways to reproduce:

http://groups.google.com/group/activeadmin/browse_thread/thread/3e52dd49c3669d4d

@felixbuenemann
Copy link
Contributor Author

Any comments or alternative approaches to solving this?

@gregbell
Copy link
Contributor

Maybe instead of inlining "all" we could implement an i18n_key method on Scope that returns the proper key given the current method?

@gregbell
Copy link
Contributor

I can merge it in and then move it there after.

gregbell added a commit that referenced this pull request Oct 21, 2011
@gregbell gregbell merged commit d91e47e into activeadmin:master Oct 21, 2011
gregbell added a commit that referenced this pull request Oct 21, 2011
I18n keys we're being generated using Scope#scope_method which can be
nil sometimes. To fix this, we moved to #scope_method || 'all'.
Instead of this approach we can reliably use #id, which will always
return a sane key.
parndt pushed a commit to resolve/active_admin that referenced this pull request Jun 13, 2012
I18n keys we're being generated using Scope#scope_method which can be
nil sometimes. To fix this, we moved to #scope_method || 'all'.
Instead of this approach we can reliably use #id, which will always
return a sane key.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants