Skip to content

Commit 927d55a

Browse files
authored
Merge pull request #2634 from ruby-grape/fix/cascade_reading_api_level
Fix `cascade` reading at Grape::API's level
2 parents 03a00a9 + 900a716 commit 927d55a

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
@@ -9,6 +9,7 @@
99

1010
#### Fixes
1111

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

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

lib/grape/dsl/routing.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ def mounted(&block)
1616
end
1717

1818
def cascade(value = nil)
19-
return inheritable_setting.namespace_inheritable.key?(:cascade) ? !inheritable_setting.namespace_inheritable(:cascade).nil? : true if value.nil?
19+
return inheritable_setting.namespace_inheritable.key?(:cascade) ? !inheritable_setting.namespace_inheritable[:cascade].nil? : true if value.nil?
2020

2121
inheritable_setting.namespace_inheritable[:cascade] = value
2222
end

spec/grape/api_spec.rb

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4715,4 +4715,16 @@ def uniqe_id_route
47154715
expect { get '/' }.to raise_error(Rack::Lint::LintError)
47164716
end
47174717
end
4718+
4719+
describe '.cascade' do
4720+
subject { api.cascade }
4721+
4722+
let(:api) do
4723+
Class.new(Grape::API) do
4724+
cascade true
4725+
end
4726+
end
4727+
4728+
it { is_expected.to be(true) }
4729+
end
47184730
end

0 commit comments

Comments
 (0)