-
Notifications
You must be signed in to change notification settings - Fork 178
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
Error when running rails console #184
Comments
Can you give us a bit more context? Are you sure |
Yes, I created a brand new rails app, and when I update web-console to |
I am also sure it is the cause of the error.
|
+1 getting the same issue |
@gsamokovarov A similar issue was reported on rails/rails#23300. I created sample app - https://github.com/prathamesh-sonpatki/web-console-console-issue, please check. |
+1, I can confirm, it's due to web-console instead of Rails master branch, if using web-console v3.0.0, such error not happen, no matter using puma 2.16.0 or rails master, so must a bug between v3.0.0 and v3.1.0 |
Confirm revert #182 will resolve this issue. |
Holy moly. Thank you folks for the investigation. I have a fix and will release 3.1.1 ASAP. |
Railties can hook themselves into the `rails console` with: ```ruby class Railtie < ::Rails::Railtie console do # Do something here. end end ``` Now, since I introduced the `#console` method in `Kernel`, every object responded to it, so this block was tried to be run on railties that respond to it. Marking the `#console` method _explicitly_ as `module_function` solves this problem as it makes it `private` and the `#respond_to?` calls during the railties initialization no longer lie. Fixes #184.
Thank you @gsamokovarov , I appreciate the quick fix! |
This is a reaction to a [bug] we hit in web-console. The cause of it was a `Kernel` extension called `#console` that was public and was fighting over Railties with console block to be run on `rails console`. We solved it by making the method private. We did that through `module_function` so `::Kernel.console` can be invoked even in `BasicObject`. I'm proposing to make most of the core Active Support `Kernel` extensions `module_function` as well. Those are currently public and we are polluting every `Object` public interface with them. ```ruby >> Object.new.respond_to? :silence_warnings => true >> Object.new.respond_to? :with_warnings => true >> Object.new.respond_to? :enable_warnings => true >> Object.new.respond_to? :suppress => true `` Some extensions like `Kernel#class_eval` should be public, but most of them don't really need to be. [bug]: rails/web-console#184
Using:
Running:
rails console
Outputs:
The text was updated successfully, but these errors were encountered: