Search code examples
javascriptjqueryruby-on-railsruby-on-rails-3prototypejs

Reverting back to using prototype


I've installed https://github.com/lleger/Rails-3-jQuery and it worked fine, however, the rails helpers that I was using with prototype stopped working.

How can I get back to using prototype in order to use the rails helpers OR make the helpers work with jQuery (the last would be the ideal solution).

Thanks


Solution

  • Actually, the gem you are using is not good enough. You should be using jquery-rails. Install as follows

    gem install jquery-rails
    

    or add it to your Gemfile

    gem 'jquery-rails'
    

    and then do

    rails g jquery:install
    

    This not only removes the prototype.js, and downloads the jquery, but also (importantly!) downloads the adapted rails.js that works with jquery and will make sure that all standard rails-helpers will keep on working.