Currently the concept of Progressive Enhancement is getting hotter and hotter. It emphasizes accessibility, semantic markup, and the importance of separating the complex rich interaction logic into well modularized javascript files. It's really a usefully way of thinking about how to modularize and manage web presentation components. But the Rails framework doesn't have good support for PE, so we have to define our own convention and helpers to make our life easier.

Usually, I'd like to organize js files in the Rails convention, which means we'll have something like this:

app
  |
  - views
      |
      - admin
          |
          _  new.html.erb
          -  index.html.erb
public
  |
  - javascripts
       |
       - admin
           |
           - new.js
           - index.js

And new.js looks similar to:
$(document).ready(function() {
  enhanceInteractionOnElements();
  
});

function helper_methods() {
  
}


Then, add the follow method to ApplicationHelper module:

def page_javascript_include_tag
  file 
= "#{params[:controller]}/#{params[:action]}.js"
  File.exist
?("#{RAILS_ROOT}/public/javascripts/#{file}"? javascript_include_tag(file) : ""
end

this method will look for js file for a particular page. And in you layout file, add one line in the head sectin:
<%= page_javascript_include_tag %>

That's it. Whenever you request an action of a particular controller, it will find and include the PE js files automatically. Now we've very very primitive support of PE in Rails framework now.