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 controls
New applications using this may also want to add
config.action_view.debug_rjs = true
to 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