Skip to content

Commit 7f263d9

Browse files
committed
Merge pull request activeadmin#689 from macfanatic/664_preserve_scope_case
activeadmin#664 - Preserve case of Scope title when provided a string
2 parents e81cbff + 72e2e64 commit 7f263d9

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

lib/active_admin/scope.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class Scope
2020
# # => Scope with name 'Published' using a block to scope
2121
#
2222
def initialize(name, method = nil, options = {}, &block)
23-
@name = name.to_s.titleize
23+
@name = name.is_a?( String ) ? name : name.to_s.titleize
2424
@scope_method = method
2525
# Scope ':all' means no scoping
2626
@scope_method ||= name.to_sym unless name.to_sym == :all

spec/unit/scope_spec.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@
2323
end
2424

2525
context "when a name and scope method" do
26-
let(:scope) { ActiveAdmin::Scope.new "My Scope", :scope_method }
27-
its(:name) { should == "My Scope"}
28-
its(:id) { should == "my_scope"}
29-
its(:scope_method) { should == :scope_method }
26+
let(:scope) { ActiveAdmin::Scope.new "With API Access", :with_api_access }
27+
its(:name) { should == "With API Access"}
28+
its(:id) { should == "with_api_access"}
29+
its(:scope_method) { should == :with_api_access }
3030
end
3131

3232
context "when a name and scope block" do

0 commit comments

Comments
 (0)