Rails 3 has some unobtrusive javascript which is pretty cool.
But I was wondering what the best way is to include additional JS for a particular page.
For example, where I might have previously done:
<%= f.radio_button :rating, 'positive', :onclick => "$('some_div).show();" %>
We can now make it unobtrusive with something like
<%= f.radio_button :rating, 'positive' %>
# then in some other file
$('user_rating_positve').click(function() {
$('some_div).show();
}
So I guess my question is where/how to include that JS? I don't want to fill up the application.js file because this JS is only applicable to this one view. Should I include a custom JS file for each page somehow, or stick it in an instance variable that the header looks for?