New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add reboot! to rails console #39239
Add reboot! to rails console #39239
Conversation
This will not reload the code actually. AFAIK the original idea was to restart console. Something like |
The env variables look to be preserved, below is the output, is that ok?
|
Good catch, fixed (I was focused on 💥 the session and forgot about this)
We already have access to IRB, so I went with a method call instead of a system call, so we don't need to jump through thor/rails cli... |
2a5d171
to
6ce6d02
Compare
c2a6c55
to
71bf618
Compare
This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. |
This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. |
puts "Rebooting..." if print | ||
existing_context = IRB.CurrentContext | ||
Rails.application.reloader.reload! | ||
IRB.start |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The console is not always IRB. It is configurable in config.console
. We need to take in consideration this.
This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. |
Summary
Add the ability to
reboot!
inside rails a console, which will clear all local/instance variables and run reload! too. This will run a new console session within the current session and also close the old IRB context.https://discuss.rubyonrails.org/t/console-is-not-aware-of-code-changes/74782/14
Not sure if a changelog needs to be added?