title: How do I run the rails web-console in production?
body: <p>I am trying to run the rails web-console from <a href="https://github.com/rails/web-console" rel="nofollow noreferrer">https://github.com/rails/web-console</a> in production. I know there are warnings against doing this, but the app where I intend to use it is internal and not accessible in production.</p>
  
  <p>Configurations I've used:</p>
  
  <p><code>config.web_console.development_only = false
  config.web_console.whitelisted_ips = %w(&lt;IPs that should have permission&gt;)</code></p>
  
  <p>So the console ends up working perfectly in development and test, but fails with a very weird error in production.</p>
  
  <pre><code>ArgumentError: wrong number of arguments (given 0, expected 1)
      from /Users/someuser/.rvm/gems/ruby-2.3.1/gems/activesupport-4.2.3/lib/active_support/core_ext/kernel/reporting.rb:89:in `capture`
      from /Users/someuser/.rvm/gems/ruby-2.3.1/gems/web-console-3.3.0/lib/web_console/view.rb:34:in `render`
      from /Users/someuser/.rvm/gems/ruby-2.3.1/gems/web-console-3.3.0/lib/web_console/template.rb:20:in `render`
      from /Users/someuser/.rvm/gems/ruby-2.3.1/gems/web-console-3.3.0/lib/web_console/middleware.rb:36:in `block in call`
      from /Users/someuser/.rvm/gems/ruby-2.3.1/gems/web-console-3.3.0/lib/web_console/middleware.rb:18:in `catch`
      from /Users/someuser/.rvm/gems/ruby-2.3.1/gems/web-console-3.3.0/lib/web_console/middleware.rb:18:in `call`
      from /Users/someuser/.rvm/gems/ruby-2.3.1/gems/actionpack-4.2.3/lib/action_dispatch/middleware/show_exceptions.rb:30:in `call`
      from /Users/someuser/.rvm/gems/ruby-2.3.1/gems/railties-4.2.3/lib/rails/rack/logger.rb:38:in `call_app`
      from /Users/someuser/.rvm/gems/ruby-2.3.1/gems/railties-4.2.3/lib/rails/rack/logger.rb:20:in `block in call`
      from /Users/someuser/.rvm/gems/ruby-2.3.1/gems/activesupport-4.2.3/lib/active_support/tagged_logging.rb:68:in `block in tagged`
      from /Users/someuser/.rvm/gems/ruby-2.3.1/gems/activesupport-4.2.3/lib/active_support/tagged_logging.rb:26:in `tagged`
      from /Users/someuser/.rvm/gems/ruby-2.3.1/gems/activesupport-4.2.3/lib/active_support/tagged_logging.rb:68:in `tagged`
      from /Users/someuser/.rvm/gems/ruby-2.3.1/gems/railties-4.2.3/lib/rails/rack/logger.rb:20:in `call`
      from /Users/someuser/.rvm/gems/ruby-2.3.1/gems/actionpack-4.2.3/lib/action_dispatch/middleware/request_id.rb:21:in `call`
      from /Users/someuser/.rvm/gems/ruby-2.3.1/gems/rack-1.6.4/lib/rack/methodoverride.rb:22:in `call`
      from /Users/someuser/.rvm/gems/ruby-2.3.1/gems/rack-1.6.4/lib/rack/runtime.rb:18:in `call`
      from /Users/someuser/.rvm/gems/ruby-2.3.1/gems/activesupport-4.2.3/lib/active_support/cache/strategy/local_cache_middleware.rb:28:in `call`
      from /Users/someuser/.rvm/gems/ruby-2.3.1/gems/actionpack-4.2.3/lib/action_dispatch/middleware/static.rb:116:in `call`
      from /Users/someuser/.rvm/gems/ruby-2.3.1/gems/rack-1.6.4/lib/rack/sendfile.rb:113:in `call`
      from /Users/someuser/.rvm/gems/ruby-2.3.1/gems/railties-4.2.3/lib/rails/engine.rb:518:in `call`
      from /Users/someuser/.rvm/gems/ruby-2.3.1/gems/railties-4.2.3/lib/rails/application.rb:165:in `call`
      from /Users/someuser/.rvm/gems/ruby-2.3.1/gems/rack-1.6.4/lib/rack/lock.rb:17:in `call`
      from /Users/someuser/.rvm/gems/ruby-2.3.1/gems/rack-1.6.4/lib/rack/content_length.rb:15:in `call`
      from /Users/someuser/.rvm/gems/ruby-2.3.1/gems/rack-1.6.4/lib/rack/handler/webrick.rb:88:in `service`
      from /Users/someuser/.rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0/webrick/httpserver.rb:140:in `service`
      from /Users/someuser/.rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0/webrick/httpserver.rb:96:in `run`
      from /Users/someuser/.rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0/webrick/server.rb:296:in `block in start_thread`
  </code></pre>
  
  <p>Can I modify the gem somehow to make it work? Or is there a workaround?</p>
  
  <p>Ruby: v2.3.1
  Rails: v4.2.1
  web-console: v3.3.0</p>
  
  <p>Thank you</p>
  
  <p>UPDATE:</p>
  
  <p>I found a solution to the problem. It has something to do with how the gem handles logging. I am still not sure why it works in development and not in production though. Here is what I did to get it to work</p>
  
  <p>I added the following code to config/initializers/web_console.rb</p>
  
  <pre><code>WebConsole::View.class_eval do
    def render(*)
      super
    end
  end
  </code></pre>
  
  <p>Essentially, I've overridden the <code>render(*)</code> method located at <a href="https://github.com/rails/web-console/commit/4ba9f5044f9322ea16f97e69b7167170c9c34522" rel="nofollow noreferrer">https://github.com/rails/web-console/commit/4ba9f5044f9322ea16f97e69b7167170c9c34522</a></p>
  
  <p>Thanks for the help everyone</p>