Skip to content

Instantly share code, notes, and snippets.

@gavinhughes
Created April 24, 2009 10:34
Show Gist options
  • Save gavinhughes/101053 to your computer and use it in GitHub Desktop.
Save gavinhughes/101053 to your computer and use it in GitHub Desktop.
# Add js functions to the page on document.ready. Arguments as strings.
# Ex: <% ready("hideDiv('div1');", "toggleFields();)")
#
def ready(*functions)
content = functions.each{ |fx| fx << ';' }.join(' ')
content_for(:head, javascript_tag("$(function() { #{content} });"))
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment