Skip to content

Instantly share code, notes, and snippets.

@caike
Created June 19, 2012 14:38
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save caike/2954563 to your computer and use it in GitHub Desktop.
Save caike/2954563 to your computer and use it in GitHub Desktop.
Including js dynamically
module ApplicationHelper
def include_user_javascript
if controller.controller_name == 'users'
javascript_include_tag 'users'
end
end
end
<!DOCTYPE html>
<html>
<head>
<title>CodeTV</title>
<%= stylesheet_link_tag "application", :media => "all" %>
<%= javascript_include_tag "application" %>
<%= include_user_javascript %>
<%= csrf_meta_tags %>
</head>
<body>
<%= yield %>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment