How to swap jquery for prototype in Rails 3.1

落爺英雄遲暮 提交于 2019-12-07 23:29:30

问题


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:


  1. Remove the jquery gem from Gemfile
  2. 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



来源:https://stackoverflow.com/questions/7534122/how-to-swap-jquery-for-prototype-in-rails-3-1

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!