Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Fixes scope behaviour when method is :all and name is set to somethin…

…g else.
  • Loading branch information...
commit 2c01b522f0e0cc689c675f6492660b1623d5bfbd 1 parent b1dc4f2
Loïc Guitaut authored

Showing 2 changed files with 8 additions and 0 deletions. Show diff stats Hide diff stats

  1. +1 0  lib/active_admin/scope.rb
  2. +7 0 spec/unit/scope_spec.rb
1  lib/active_admin/scope.rb
@@ -24,6 +24,7 @@ def initialize(name, method = nil, options = {}, &block)
24 24 @scope_method = method
25 25 # Scope ':all' means no scoping
26 26 @scope_method ||= name.to_sym unless name.to_sym == :all
  27 + @scope_method = nil if method && method.to_s == 'all'
27 28 @id = @name.gsub(' ', '').underscore
28 29 if block_given?
29 30 @scope_method = nil
7 spec/unit/scope_spec.rb
@@ -22,6 +22,13 @@
22 22 its(:scope_block) { should == nil }
23 23 end
24 24
  25 + context 'when a name and scope method is :all' do
  26 + let(:scope) { ActiveAdmin::Scope.new 'Tous', :all }
  27 + its(:name) { should eq 'Tous' }
  28 + its(:scope_method) { should be_nil }
  29 + its(:scope_block) { should be_nil }
  30 + end
  31 +
25 32 context "when a name and scope method" do
26 33 let(:scope) { ActiveAdmin::Scope.new "With API Access", :with_api_access }
27 34 its(:name) { should == "With API Access"}

0 comments on commit 2c01b52

Please sign in to comment.
Something went wrong with that request. Please try again.