aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZachary Scott <e@zzak.io>2015-02-16 10:07:03 -0800
committerZachary Scott <e@zzak.io>2015-02-16 10:07:03 -0800
commitba8502171e4e0024f7112192c664159bfdab5b82 (patch)
tree450bae99e0872f8b1e047a063372e01ce99dc991
parentbaf571dd0dc9dae1a5865f2e8d9dabfe11325ccc (diff)
parentb7d316cd56a0cd4bff592c2293b3dddf696d9b15 (diff)
downloadrails-ba8502171e4e0024f7112192c664159bfdab5b82.tar.gz
rails-ba8502171e4e0024f7112192c664159bfdab5b82.tar.bz2
rails-ba8502171e4e0024f7112192c664159bfdab5b82.zip
Merge pull request #18679 from adipra3n/master
Add web console in debugging rails applications guide [ci skip]
-rw-r--r--guides/source/debugging_rails_applications.md52
1 files changed, 52 insertions, 0 deletions
diff --git a/guides/source/debugging_rails_applications.md b/guides/source/debugging_rails_applications.md
index a2d2e93e3b..6113a61f4c 100644
--- a/guides/source/debugging_rails_applications.md
+++ b/guides/source/debugging_rails_applications.md
@@ -242,6 +242,58 @@ The contents of the block, and therefore the string interpolation, is only
evaluated if debug is enabled. This performance savings is only really
noticeable with large amounts of logging, but it's a good practice to employ.
+
+Debugging with the `web-console` gem
+-------------------------------------
+
+The web console allows you to create an interactive ruby session in your browser. An interactive
+console is launched automatically in case on an error but can also be launched for debugging purposes
+by invoking `console` in a view or controller.
+
+For example in a view:
+
+```ruby
+# new.html.erb
+<%= console %>
+```
+
+Or in a controller:
+
+```ruby
+# posts_controller.rb
+class PostsController < ApplicationController
+ def new
+ console
+ @post = Post.new
+ end
+end
+```
+###config.web_console.whitelisted_ips
+
+By default the web console can only be accessed from localhost. `config.web_console.whitelisted_ips`
+lets you control which IPs have access to the console.
+
+For example, to allow access from both localhost and 192.168.0.100:
+
+```ruby
+# config/application.rb
+class Application < Rails::Application
+ config.web_console.whitelisted_ips = %w( 127.0.0.1 192.168.0.100 )
+end
+```
+
+To allow access from an entire network:
+
+```ruby
+# config/application.rb
+class Application < Rails::Application
+ config.web_console.whitelisted_ips = %w( 127.0.0.1 192.168.0.0/16 )
+end
+```
+
+Web console is a powerful tool so be careful who you open access to.
+
+
Debugging with the `byebug` gem
---------------------------------