Caleb Sayre
Caleb Sayre

Reputation: 401

javascript_include_tag causes ActionView::Template::Error

I am getting this error in a staging environment. So far I cannot reproduce this error on my local machine in development. This is the error that I am getting:

An ActionView::Template::Error occurred in widgets#options:


app/views/wa_admin/widgets/options.html.erb:50:in `_app_views_wa_admin_widgets_options_html_erb___4438918489025291975_70301100178220'

The line of code that is causing this is this:

<%= javascript_include_tag "scriptaculous-js-1.9.0/lib/prototype" %>

Which that file does exist within the assets/javascripts directory. Does anybody know what the issue is? Or at least how I can debug this further?

Upvotes: 1

Views: 422

Answers (1)

Ahmed Samir Shahin
Ahmed Samir Shahin

Reputation: 558

It's expected that you can't re-produce the error in development; because in development the fallback to app/assets directory is enabled ( config.assets.compile = true) .. check config/environments/development.rb.

But in staging, production environments: the fallback to app/assets directory option is disabled.

Thus, the solution is to precompile assets during the deployment.

To make sure that this is the reason, You can run locally rake assets:precompile then push the newly created assets directory, then deploy to staging, it should work.

Upvotes: 1

Related Questions