0

If there a way to include the content of a javascript file into a Rails view?

I know about Ruby's File.read, but I'm searching for some helper already done.

David Morales
  • 17,816
  • 12
  • 77
  • 105

1 Answers1

0
<%= javascript_tag do %>
  <%= render :file => '/path/to/rails/app/path/to/javascript.js' %>
<% end %>

So you can include any javascript code located on your machine. But to be honest there's more appropriate way to do that kind of things.

Community
  • 1
  • 1
jibiel
  • 8,175
  • 7
  • 51
  • 74