Permalink
Browse files

Instead of inlining "all" for #637, use Scope#id

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.
  • Loading branch information...
1 parent 6f3fbdf commit 08d49bd5ca352254b70774f1905befe6681bec45 @gregbell gregbell committed with parndt Oct 21, 2011
Showing with 2 additions and 1 deletion.
  1. +1 −1 lib/active_admin/views/components/scopes.rb
  2. +1 −0 spec/unit/scope_spec.rb
View
2 lib/active_admin/views/components/scopes.rb
@@ -17,7 +17,7 @@ def build(scopes)
def build_scope(scope)
span :class => classes_for_scope(scope) do
begin
- scope_name = I18n.t!("active_admin.scopes.#{scope.scope_method||'all'}")
+ scope_name = I18n.t!("active_admin.scopes.#{scope.id}")
rescue I18n::MissingTranslationData
scope_name = scope.name
end
View
1 spec/unit/scope_spec.rb
@@ -51,4 +51,5 @@
end
end
+
end

0 comments on commit 08d49bd

Please sign in to comment.