问题
I have a rails 3.1 project that was created with the default jQuery. What is the best way to convert the project to use prototype instead?
回答1:
- Remove the jquery gem from Gemfile
- add prototype-rails to it
From https://github.com/rails/prototype-rails:
You may want to add them to your app/assets/javascripts/application.js:
//= require prototype //= require prototype_ujs //= require effects //= require dragdrop //= require controlsNew applications using this may also want to add
config.action_view.debug_rjs = trueto their config/environments/development.rb.
回答2:
diodeus is right, i'd rewrite it, and take it as a great opportunity to improve the code ;) nevertheless i'm curious, why would you wanna switch TO prototype
来源:https://stackoverflow.com/questions/7534122/how-to-swap-jquery-for-prototype-in-rails-3-1