Custom initializers seems to not work good with rails console
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 25/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- rails, ruby
- Domain
- cli, developer-experience, tooling
Research direction
Reproduce the behavior using the custom /lib/my_module.rb, /config/initializers/my_module.rb, and rails c described in the issue, comparing a fresh initializer edit with later console starts. Trace how Spring and the Rails console load or reuse the initializer, and consider the issue resolved when MyModule.some_attr consistently reports 'some_val' without requiring an immediate initializer edit.
Written by the indexing model from the issue text.
Description
Hey Guys, I've recently posted a question on SO, but no one answers, I think that my issue is actually related to spring, here's the question:
https://stackoverflow.com/questions/48461291/ruby-on-rails-5-2-0-beta2-initializers-loading
Long story short: I have a custom (not from any gem) module in /lib/my_module.rb inside a rails (5.2.0.beta2) project, like this:
module MyModule
mattr_accessor :some_attr
self.some_attr = nil
# Default way to setup MyModule.
def self.setup
yield self
end
end
And I have an initializer for it, /config/initializers/my_module.rb:
MyModule.setup do |config|
config.some_attr = 'some_val'
end
But when I run rails c I have MyModule.some_attr set to nil always, and only if I change something in MyModule initializer and nothing else after it, and run rails c immediately I have MyModule.some_attr set to 'some_val'.
- Dominant language
- Ruby
- Stars
- 2.8k
- Forks
- 342
- PR merge metrics
- No merged PRs in 30d
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from rails/spring
-
bug
Difficulty 4/5 3-5 days Newbie friendliness 30/100
-
bug
Difficulty 3/5 1-2 days Newbie friendliness 52/100
-
bug
Difficulty 4/5 3-5 days Newbie friendliness 45/100
-
bug
Difficulty 4/5 3-5 days Newbie friendliness 32/100
-
bug
Difficulty 4/5 3-5 days Newbie friendliness 38/100
Similar issues
-
バグ
Difficulty 1/5 Under an hour Newbie friendliness 92/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
voxpupuli/puppet-epel#186 · 1 comment ·
-
external_created_at is no longer used for the message timestamp since the new message UI (v4.4.0) OpenBug Frontend
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
TheOdinProject/curriculum#31402 · 1 comment ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100