Skip to content

Instantly share code, notes, and snippets.

@misfo
Created April 11, 2009 08:08
Show Gist options
  • Save misfo/93499 to your computer and use it in GitHub Desktop.
Save misfo/93499 to your computer and use it in GitHub Desktop.
$(function() {
alert("Hello from <%= params[:action] %>");
});
$(function() {
alert("<%= Rails.version %>");
});
<html>
<head>
<title>Super Awesome!!!11</title>
<%= javascript_include_tag 'jquery-1.3.2' %>
<%= yield :head %>
<%= default_javascript %>
</head>
<body>
<%= yield %>
</body>
</html>
module ApplicationHelper
def default_javascript
js = ""
begin
js << render(:partial => "default.js")
rescue ActionView::MissingTemplate
end
begin
js << render(:partial => "#{params[:action]}.js")
rescue ActionView::MissingTemplate
end
javascript_tag(js) unless js.blank?
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment