Jump to content

The ultimate community for Ruby on Rails developers.


WeBRick not compiling sending assets on request: Throws "Missing Template" Exception Instead

webrick asset compilation

  • Please log in to reply
2 replies to this topic

#1 eggmatters



  • Members
  • 3 posts

Posted 10 June 2014 - 08:48 PM

This one is tricky.


I am working in a Rails application which is live and in production and steadily growing more complex. We serve a single-app with compiled assets rendering one ejb and then javascript handles specific page layouts.


 We use the following gems to provide this:

group :assets do
  gem 'jquery-rails'
  gem 'lodash-rails'
  gem 'handlebars_assets'
  gem 'less-rails'
  gem 'less-rails-bootstrap'
  gem 'less-rails-fontawesome'
  gem 'backbone-on-rails'
  gem 'marionette-rails'
  gem 'accountingjs-rails'
  gem 'yui-compressor'
  gem "momentjs-rails"

The three important gems are:

  • handlebars_assets: templating library creates dynamic html
  • less-rails*: css compiler
  • backbone-on-rails: BackboneJS library - the core structure of our app

Currently, we serve the app in production using Phusion Passenger running as an apache virtual server.


Here is some background to my situation:

I am trying to implement an aternate WEBRick server so I can implement step through debugging on my IDE. (NetBeans 8.0)

The application runs in SSL, so I had to implement a WEBRick SSL configuration.


Webrick in SSL starts succesffully. The Netbeans debugger works (I can step through code)

When I make a specific page request in the browser, the page loads, but it is unstyled and unpopulated. None of the assets (which are compiled per request in the development environment) are present.


The logs throw a missing template exception for each requested asset:

2013-06-24 07:45:49.149 UTC [] [|] [21784] FATAL [/var/lib/gems/1.9.1/gems/actionpack-3.2.15/lib/action_dispatch/middleware/debug_exceptions.rb:70:in `block in log_error']
ActionView::MissingTemplate (Missing template tools/index, application/index with {:locale=>[:en], :formats=>[:gif], :handlers=>[:erb, :builder, :rabl]}. Searched in:
  * "/opt/rails_app/repo/www/ruby/internal/app/views"
  * "/var/lib/gems/1.9.1/bundler/gems/jasminerice-091349c27343/app/views"
  app/controllers/tools_controller.rb:4:in `index'
  app/middleware/session_logger.rb:12:in `call'

. . . .
and so on for each requested asset.

jasmine-rice is a client script testing library. Not sure if or how it's invovled with this.


Starting WEBRick from either NetBeans or the console has the same behavior.


The configuration options for asset compilation are set in the app/config/environments/development.rb script:

config.cache_classes = false
config.consider_all_requests_local       = true
config.action_controller.perform_caching = false
# Do not compress assets
config.assets.compress = false

# Expands the lines which load the assets
config.assets.debug = true

And just for kicks, my scritps/rails script:

#!/usr/bin/env ruby
# This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
require 'rails/commands/server'
require 'rack'
require 'webrick'
require 'webrick/https'

module Rails
    class Server < ::Rack::Server
        def default_options
                :Port => 3001,
                :Host => "localhost",
                :environment => (ENV['RAILS_ENV'] || "development").dup,
                :daemonize => false,
                :debugger => false,
                :pid => File.expand_path("tmp/pids/server.pid"),
                :config => File.expand_path("config.ru"),
                :SSLEnable => true,
                :SSLVerifyClient => OpenSSL::SSL::VERIFY_NONE,
                :SSLPrivateKey => OpenSSL::PKey::RSA.new(
                :SSLCertificate => OpenSSL::X509::Certificate.new(
                :SSLCertName => [["CN", WEBrick::Utils::getservername]],

APP_PATH = File.expand_path('../../config/application',  __FILE__)
require File.expand_path('../../config/boot',  __FILE__)
require 'rails/commands'

#2 Ohm



  • Moderators
  • 529 posts
  • LocationCopenhagen

Posted 10 June 2014 - 10:54 PM

Is there an tools/index.gif-file, maybe an index.gif.erb-file (I doubt it!) as this is the file that your application is looking for?

Blog: http://ohm.sh | Twitter: @madsohm | Work: Lokalebasen.dk

#3 eggmatters



  • Members
  • 3 posts

Posted 13 June 2014 - 10:40 PM

@Ohm, The index.gif is maybe not the best example. All of the assets are in located in app/assets/ with app/assets/images, app/assets/javascripts, etc. The "tools" url is mapped by the router to load just one erb, and all of the assets are compiled and sent along.

Also tagged with one or more of these keywords: webrick, asset compilation

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users