js with erb produces syntax error, unexpected ';'
I had JS file that was included in the Rails 4 app. Then I added Ruby
logic to the JS file and renamed it to ERB. In my html.erb template I have
something like this:
<% content_for :head do %>
<%= javascript_include_tag :top_cash_rate_widget %>
<% end -%>
Which results in syntax error, unexpected ';' However whenever I remove
.erb extension from .js file it works as fine as it was.
Please note, that I also commented out all Ruby code inside of the .js.erb
file.
I know it's not the best practice to use Ruby code inside of JS, but for
speed purposes I did it :)
No comments:
Post a Comment