The blog has moved to ... Many google searches point here so I am leaving it operational, but there will be no new posts.

Sunday, May 29, 2011

rails 3.1 javascript execution

Looking at a few different ways to execute javascript in rails 3.1. By default all javascript is compiled into one file and embedded in anonymous functions which all execute on each page.

We often want to be selective in how our javascript executes, based on controller and actions. We look at 3 different approaches

  • use selectors based on form id
  • use selectors based on css classes on the body
  • namespaced javascript objects

if you know of any other approaches I would love to hear those as well

I recommend you click the HD link on the player and view it on Vimeo in full screen mode, this embed version is not so crisp.


1 comment:

Internet008 said...


I like third way.