Javascript_include_tag error

<%= @title %> <%= csrf_meta_tag %> <%= javascript_include_tag "http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js", "jquery.rails.js" %> ...app/views/layouts/application.html.erb:7: syntax error, unexpected ',', expecting ')' ...bs/jquery/1.6.2/jquery.min.js", "jquery.rails.js" ... ^ Extracted source (around line #7): 4: <%= @title %> 5: <%= csrf_meta_tag %> 6: <%= javascript_include_tag 7: "http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js", "jquery.rails.js" 8: %> 9: 10: As far as I can tell, that is the same syntax used at the end of this railscast: http://railscasts.com/episodes/205-unobtrusive-javascript rails 3.0.9

I guess I can always just do this:

but I’m still wondering why I got the error.

On 10 Aug 2011, at 19:15, 7stud – wrote:

“jquery.rails.js”
8: %>
9:
10:

Ruby looks at the code in line 6, and thinks you’re just calling
javascript_include_tag without any arguments. It then tries to parse
line 7 as a new statement, but doesn’t know what to do with a string
followed by a comma.

If you put the first argument to javascript_include_tag on the same line
(i.e. combine lines 6 and 7), then Ruby will know you’re listing
arguments to javascrip_include_tag, and it’ll work.

Chris

Chris M. wrote in post #1016050:

If you put the first argument to javascript_include_tag on the same line
(i.e. combine lines 6 and 7), then Ruby will know you’re listing
arguments to javascrip_include_tag, and it’ll work.

Thanks. That means I can do this:

<%=
javascript_include_tag(
http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js”,
“jquery.rails.js”)
%>