Skip to content

Commit

Permalink
Fix rails console invocation inside a Rails app
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
gsamokovarov committed Jan 28, 2016
1 parent d424ec7 commit be9290a
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/web_console/extensions.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
module Kernel
module_function

# Instructs Web Console to render a console in the specified binding.
#
# If +bidning+ isn't explicitly given it will default to the binding of the
Expand Down

0 comments on commit be9290a

Please sign in to comment.