Skip to content

Instantly share code, notes, and snippets.

@buren
Last active February 13, 2016 18:16
Show Gist options
  • Save buren/c408bc0b22da3e3f3080 to your computer and use it in GitHub Desktop.
Save buren/c408bc0b22da3e3f3080 to your computer and use it in GitHub Desktop.
Attach a rails web console to any page by adding ?web_console=
# config/initializers/web_console.rb
WebConsoleBeforeAction = ->(controller) do
controller.console if controller.params[:web_console]
end
ApplicationController.before_action(WebConsoleBeforeAction) if defined?(WebConsole) && Rails.env.development?
# NOTE:
# For security reasons only do this in development.
@sb8244
Copy link

sb8244 commented Jan 24, 2015

&& !Rails.env.production?

@buren
Copy link
Author

buren commented Jan 24, 2015

I would never load WebConsole in production.
Updated the gist anyway.. Thanks @sb8244 :)

@GiaoGiaoCat
Copy link

Cool, tks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment