Skip to content

Instantly share code, notes, and snippets.

@cpjolicoeur
Created January 20, 2010 22:03
Show Gist options
  • Save cpjolicoeur/282330 to your computer and use it in GitHub Desktop.
Save cpjolicoeur/282330 to your computer and use it in GitHub Desktop.
## in your app layout file in the <head> section add this
<script type="text/javascript">
<%= yield :scripts_text %>
</script>
## in your action view erb file do this at the bottom
<% content_for :scripts_text do %>
// raw JS here or erb interpreted JS
var my_var = <%= SOME_RUBY_CONSTANT %>;
<% end %>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment