Currently, it seems as though my jquery and other js files aren’t being included in my views..
I have this gem in my gem file:
gem ‘jquery-rails’, ‘>= 1.0.12’
I’m using rails 3.1.0
in my header is:
<head>
<%= stylesheet_link_tag :all %>
<%= javascript_include_tag :defaults %>
<%= csrf_meta_tag %>
</head>
The html coming through the view is this:
<head>
<link href="/assets/all.css" media="screen" rel="stylesheet" type="text/css" />
<script src="/assets/defaults.js" type="text/javascript"></script>
<meta content="authenticity_token" name="csrf-param" />
<meta content="scIP+mIH7ON1DYP9XWeSidk/5i4DizpuwQOP8mcxA9M=" name="csrf-token" />
</head>
in my config/application.rb file I also have:
config.action_view.javascript_expansions[:defaults] = %w(jquery rails)
Any help would be greatly appreciated
In rails 3.1, you want this instead:
That way it’ll use the asset pipeline. Without it, it’s looking for all.css and defaults.js