Skip to content

Commit ab9e9cc

Browse files
committed
Replace () by []
1 parent d4244ab commit ab9e9cc

File tree

3 files changed

+14
-1
lines changed

3 files changed

+14
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
#### Fixes
99

10+
* [#2633](https://github.com/ruby-grape/grape/pull/2633): Fix cascade reading - [@ericproulx](https://github.com/ericproulx).
1011
* Your contribution here.
1112

1213
### 3.0.1 (2025-11-24)

lib/grape/api/instance.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ def call!(env)
7878

7979
# (see #cascade?)
8080
def cascade(value = nil)
81-
return inheritable_setting.namespace_inheritable.key?(:cascade) ? !inheritable_setting.namespace_inheritable(:cascade).nil? : true if value.nil?
81+
return inheritable_setting.namespace_inheritable.key?(:cascade) ? !inheritable_setting.namespace_inheritable[:cascade].nil? : true if value.nil?
8282

8383
inheritable_setting.namespace_inheritable[:cascade] = value
8484
end

spec/grape/api_spec.rb

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4722,4 +4722,16 @@ def uniqe_id_route
47224722
expect { get '/' }.to raise_error(Rack::Lint::LintError)
47234723
end
47244724
end
4725+
4726+
describe '.cascade' do
4727+
subject { api.cascade }
4728+
4729+
let(:api) do
4730+
Class.new(Grape::API) do
4731+
cascade true
4732+
end
4733+
end
4734+
4735+
it { is_expected.to eq(true) }
4736+
end
47254737
end

0 commit comments

Comments
 (0)