i'm new to rails (using rails 2.3.10) and would like to use jquery in particular jquery ui. the project is a brand new project and i'm planning to use some widgets from jquery ui like datapicker and selectable, etc. i having been hearing that jrails can be installed to replace prototype in rails2 and i have the following questions.
- what is the difference between rails with and without jrails in term of developing a new rails app?
- what is the advantage of using jrails?
- is jrails a must for using jquery ui widgets in my rails app?
- any recommended tutorials of integrating jquery plugins in particular jquery ui selectable widget into a rails app?
thanks batterhead
user661684 asked
回答:
First up, if you're writing a brand new project, I would recommend considering using Rails 3. Among other things, it actually abstracts away the default JS framework used by Rails, so it's much easier to remove Prototype entirely from Rails 3.
As far as using jQuery UI, nothing is stopping you from including jQuery and jQuery UI in the project. Prototype and jQuery can live together in your app just fine (though you need to set a flag so that jQuery doesn't override prototype's "$" function; how to do that is another question).
The only reason jRails was written is because of the RJS features of Rails 2 -- the ability to write javascript templates on the server. Prototype is intrinsically linked to the RJS functionality of Rails, as all the helper methods for RJS would translate to Prototype calls. In Rails 3, that functionality has been deprecated in favor of using more unobtrusive javascript (UJS) techniques, so all the JS code stays on the client side. Thus, the reliance on Prototype is no longer an issue in Rails 3.
TL;DR
-
Without jRails, all javascript generated server-side will translate in to prototype javascript calls on the client-side -- RJS template helper methods,
link_to :method => :delete
calls, etc.With jRails, all those server-side methods will translate in to jQuery calls client-side instead.
-
See above; a Rails 2 app's server-side helpers that generate javascript will use jQuery instead of prototype.
-
No. jRails only affects the javascript generated server-side.
-
You can include and use jQuery in your app in the same way you would include any other javascript resource in Rails 2. Once jQUery is included, its no different to using it on plain HTML, so look at the jQuery UI tutorials on how to use the datepicker or selectable
相关推荐
jquery-rails, 一个 gem,用于自动使用jQuery和 Rails 3 railsjQuery 面向 Rails 如此伟大。这里 gem 提供:jQuery 1.7.2jQuery UI 1.8.18 ( 仅适用于 javascript )jQuery UJS适配器assert_select_j
jquery-datatables-rails, 用于 Rails的jquery数据表 gem jquery-datatables-rails 这个 gem 为 jQuery DataTables插件提供了方便,以便与 Rails 资产pipleine结合使用。 它提供所有基本的datatable文件,以及一些...
jquery-ui+jquery-ui-rails
jquery-fileupload-rails, 用于 Rails的jQuery文件上传集成 Rails 文件上传jQuery-File-Plugin 是一个文件上传插件,由的Tschan 。 jQuery文件上传功能多文件选择。drag&拖放支持。进度栏和jQuery预览图像。 支持...
jquery-validation-rails, 对 Rails 资产管道的jQuery验证 :: 验证:: rails针对 Rails 资产管道的...安装这里 gem将以下行添加到项目的Gemfile 中:gem 'jquery-validation-rails'在你的终端中运行以下命令:cd ~/pa
用 jQuery 替代Prototype/script.aculo.us 在Rails做 helpers 实现 javascript 的功能,jQuery library的优点: 快速简洁优雅. 也支持JQuery与Prototypea共存,方法如下: 1、将jquery.js放到prototype.js后面(这个...
在Rails 4中使用jQuery自动完成的一种简单方法。 同时支持ActiveRecord, 和 。 与和 在你开始之前 在继续之前,请确保您的项目正在使用jQuery-UI和自动完成小部件。 您可以在此处找到有关此信息的更多信息: 我...
jRails是一个替代 Rails 中的Prototype/script.aculo.us 为 jQuery 的项目。使用 jRails,你能获得所有缺省的Rails helpers 来使用jQuery库。 安装方法: ./script/plugin install ...
运行bundle list ,以确保你要么不使用jquery-rails ,或者至少是3.0.0版本的jquery-rails 。 用法 在您的Gemfile中,添加: gem 'jquery-ui-rails' 需要一切 要需要所有jQuery UI模块,请将以下内容添加到...
rails-behaviors, jQuery和Zepto的Rails UJS行为 Rails 行为( 不推荐使用)Rails 行为实现了 Rails 3. x. 生成的data-* 行为这是一个替代 jquery-ujs的方法。 首先,它都是CoffeeScript好的,这对我来说很好 ! 其次...
假设您使用的是茉莉花宝石,则在jasmine.yml中具有: src_files:-...-资产/茉莉花jquery.js 或直接包含在/assets/jasmine-jquery.js 用法 阅读有关jasmine-jquery的 贡献 jasmine-jquery-rails和jasmine-jquery由...
Brevidy, 使用 Ruby on Rails HAML Bootstrap 和jQuery构建的视频社交网络 Brevidy通过 Gratipay 支持这里项目 Brevidy是我用 Ruby on Rails 3.0.7.HAML 。Bootstrap 和jQuery构建的视频社交网络,它被发布到beta...
该宝石提供: jQuery 1、2和3 jQuery UJS适配器assert_select_jquery在Ruby测试中测试jQuery响应版本号从v2.1开始,jquery-rails gem遵循以下版本指南,以从Gemfile中更好地控制应用程序的jQuery版本: patch ...
在以下情况下自动回退到jquery-rails捆绑的jQuery: 您正在开发环境中,以便可以脱机工作。 CDN已关闭或无法访问。 最重要的是,如果您使用资产管道,则可能已经注意到组合的application.js中的主要代码块是...
NULL 博文链接:https://michael-roshen.iteye.com/blog/1743358
这是一个在Rails应用程序中使用React并使用webpack的示例
NULL 博文链接:https://hlee.iteye.com/blog/587000
状态这是官方维护的分支Rails 4及更高版本的所有新功能和支持将在此处继续进行。 该前叉还支持Rails 3。 Rails 3的错误修复和安全修复将继续,直到Rails 3终止...正在安装将宝石包含在您的Gemfile中gem 'rails-jquery-
shoppe-example, 在 Rails 中使用Shoppe平台的示例存储实现 这是一个 Rails 应用程序,它使用 Shoppe 构建。 它具有一个可以爱的设计,以充分演示Shoppe平台提供的功能以及它在 Rails 应用程序中的。 正在启动要开始...
rails2-sample good book