Note that there are some explanatory texts on larger screens.

plurals
  1. PORails 3.1 issue with javascript_include_tag in application.html.erb
    primarykey
    data
    text
    <p>I've created a clean and simple Rails 3.1 application called demo1. It contains two controllers - hello and goodbye. I get the following error when I try to load <a href="http://localhost:3000/say/hello">http://localhost:3000/say/hello</a>:</p> <pre><code>ActionView::Template::Error ( (in /home/me/dev/ruby/demo1/app/assets/javascripts/say.js.coffee)): 3: &lt;head&gt; 4: &lt;title&gt;Demo1&lt;/title&gt; 5: &lt;%= stylesheet_link_tag "application" %&gt; 6: &lt;%= javascript_include_tag "application" %&gt; 7: &lt;%= csrf_meta_tags %&gt; 8: &lt;/head&gt; 9: &lt;body&gt; app/views/layouts/application.html.erb:6:in `_app_views_layouts_application_html_erb___558576499_89622220' </code></pre> <p>The problematic line of <strong>application.html.erb</strong> is:</p> <pre><code>&lt;%= javascript_include_tag "application" %&gt; </code></pre> <p>When I created the application using Rails 3.0 this particular line was:</p> <pre><code>&lt;%= javascript_include_tag :defaults %&gt; </code></pre> <p>And this worked fine. In fact, when I change the application.html.erb to use :defaults everything works, but I want to use the new features of Rails 3.1.</p> <p>I can't seem to turn up anything on Google around this, I guess because Rails 3.1 has just been released.</p> <p>By the way, I'm following the first chapter in the <a href="http://pragprog.com/book/rails4/agile-web-development-with-rails">Agile Web Development with Rails (4th edition) Updated for Rails 3.1</a> book.</p> <p>Some environmental info that may help in answering this question:</p> <pre><code>$ cat /etc/issue Ubuntu 10.04.2 LTS \n \l $ ruby -v ruby 1.9.2p290 (2011-07-09 revision 32553) [i686-linux] $ rails -v Rails 3.1.0 </code></pre> <p>Contents of the <strong>say.js.coffee</strong> file:</p> <pre><code># Place all the behaviors and hooks related to the matching controller here. # All this logic will automatically be available in application.js. # You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/ </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload