In Rails 3.1 it is not possible to access controller instance variables in an asset js.erb or coffee.erb file using syntax such as <%= @foo %>, where @foo is set in the c
In the controller:
@foo_attr = { "data-foo-1" => 1, "data-foo-2" => 2 }
In the view (HAML):
#foo{@foo_attr}
In the CoffeeScript asset:
$("#foo").data("foo-1") $("#foo").data("foo-2")