首先建立一个新项目,实际上有没有-J都无所谓
1 | rails new helloworld - J |
然后,在项目的Gemfile中添加,
1 | gem 'jquery-rails' |
运行
1 | bundle install |
再运行
1 | rails generate jquery :install |
这时Prototype和相应JS就会被删除,而替换成JQuery的JS。
如果你要使用JQuery UI的话在上面命令后面加个 --ui就可以了。
这样你项目中的Prototype就被替换成JQuery了。
http://lindsaar.net/2010/5/9/Getting-Rails-3-Edge-with-jQuery-RSpec-and-Cucumber-using-RVM