Rbjs is a ruby gem that enables you to write remote javascript in Rails 3. It keeps the browser logic-less. read more
Add the line
gem 'rbjs'
to your Gemfile and run
bundle install
Please refer to the documentation for a quick example and usage guide.