Marco A
Marco A

Reputation: 109

jquery/javascripts not loading in ruby on rails

I am having a very weird problem that just came up and my guess it's that it may be easy to solve, I just can't seem to figure out.

in my layout/application.html.haml, I have the following:

= javascript_include_tag :all

Rather than RoR translating this to a lot of script-loading lines, it does the following:

<script src="/beta/assets/all.js" type="text/javascript"></script>

similarly, with defaults I get:

<script src="/beta/assets/defaults.js" type="text/javascript"></script>

What should I look for? or what I am missing?

Thanks!

Upvotes: 0

Views: 1040

Answers (2)

xdazz
xdazz

Reputation: 160833

The :all option in Rails 3.1 is deprecated.

Instead, you should do something like:

<%= javascript_include_tag "application" %>

And in your application.js add the js file you want to load. require_tree . will add all the js file in the same directory with application.js.

//= require jquery
//= require jquery_ujs
//= require jquery-ui
//= require_tree .

Upvotes: 0

Andrei S
Andrei S

Reputation: 6516

if you're using the asset pipeline you should add

<%= javascript_include_tag "application" %>

and in your application.js add your required js files

Upvotes: 1

Related Questions