Skip to content

Commit 0f1c547

Browse files
fbuyspalkan
authored andcommitted
fix: NameError caused by undefined secrets instance variable
To fix a bug found after upgrading a legacy application to Rails 8. The application makes use of yabeda-rails. Fixes: #158
1 parent 2ea0544 commit 0f1c547

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
## master
44

5+
- Address NameError: instance variable @secrets not defined issue ([@fbuys][])
6+
57
## 2.7.1 (2025-02-24)
68

79
- Suppress required validations when running Rails credentials commands. ([@palkan][])

lib/anyway/rails/loaders/secrets.rb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,11 @@ def secrets
2828
# Reset secrets state if the app hasn't been initialized
2929
# See https://github.com/palkan/anyway_config/issues/14
3030
next if ::Rails.application.initialized?
31+
32+
# Address unable to load application: NameError: instance variable @secrets
33+
# not defined
34+
next unless ::Rails.application.instance_variable_defined?(:@secrets)
35+
3136
::Rails.application.remove_instance_variable(:@secrets)
3237
end
3338
end

0 commit comments

Comments
 (0)