Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Fixes scope behaviour when method is :all and name is set to something else #1180

Merged
merged 1 commit into from

3 participants

@Flink

Typically when using I18n to translate the displayed scope and specifying the method.

@pcreux pcreux was assigned
@pcreux
Collaborator

Cool!

@gregbell gregbell merged commit 379bc72 into from
@pcreux pcreux was unassigned by Flink
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Mar 27, 2012
  1. @Flink
This page is out of date. Refresh to see the latest.
Showing with 8 additions and 0 deletions.
  1. +1 −0  lib/active_admin/scope.rb
  2. +7 −0 spec/unit/scope_spec.rb
View
1  lib/active_admin/scope.rb
@@ -24,6 +24,7 @@ def initialize(name, method = nil, options = {}, &block)
@scope_method = method
# Scope ':all' means no scoping
@scope_method ||= name.to_sym unless name.to_sym == :all
+ @scope_method = nil if method && method.to_s == 'all'
@id = @name.gsub(' ', '').underscore
if block_given?
@scope_method = nil
View
7 spec/unit/scope_spec.rb
@@ -22,6 +22,13 @@
its(:scope_block) { should == nil }
end
+ context 'when a name and scope method is :all' do
+ let(:scope) { ActiveAdmin::Scope.new 'Tous', :all }
+ its(:name) { should eq 'Tous' }
+ its(:scope_method) { should be_nil }
+ its(:scope_block) { should be_nil }
+ end
+
context "when a name and scope method" do
let(:scope) { ActiveAdmin::Scope.new "With API Access", :with_api_access }
its(:name) { should == "With API Access"}
Something went wrong with that request. Please try again.