如何在 Rails 3.1 中为原型交换 jquery [英] How to swap jquery for prototype in Rails 3.1

查看:27
本文介绍了如何在 Rails 3.1 中为原型交换 jquery的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个使用默认 jQuery 创建的 rails 3.1 项目.将项目转换为使用原型的最佳方法是什么?

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. 从 Gemfile 中删除 jquery gem
  2. 向其中添加原型导轨

来自https://github.com/rails/prototype-rails:

您可能想将它们添加到您的应用程序/资产/javascripts/application.js:

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

到他们的 config/environments/development.rb.

to their config/environments/development.rb.

这篇关于如何在 Rails 3.1 中为原型交换 jquery的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆