Skip to content

Instantly share code, notes, and snippets.

View shamus's full-sized avatar

Jeremy Morony shamus

View GitHub Profile
@shamus
shamus / gist:5537611
Last active December 17, 2015 02:39
A strategy for loading page specific javascript

At the bottom of app/assets/javascripts/application.js.coffee.erb

page =
  ready: (initializer)->
    $(document).ready ->
      initializer(application.page)

window.<%= Rails.application.class.parent_name%> ?=
 page: page