I hope you forgive me if I'm a little confused about this.
Jrails rewrites all the helper methods for rjs otherwise in prototype.
Jquery-rails overrides rails.js (so I taught the rjs helpers as well, but I see it's not) and the rest of the libraries in jquery instead of prototype.
Does it means that with just Jquery-rails I can't use rjs at all? Then do these gems work well together and let me completely forget prototype? Is there any disadvantage in using them together?
I read some complaining about the fact that jrails uses jq 1.5 and now there is 1.8, but jquery-rails gives me the last version (is t开发者_StackOverflowhere retro compatibility?), but how will this affect my development (using both the gems together)? I mean Have you got some examples of jquery-ui plugins I can't use, or I could have problems with latest versions?
Any help is appreciated.
Don't get me wrong, I'm not against prototype, just I keep on having conflicts over conflicts using both of them, and if I have to choose I pick Jquery.
Yes, RJS requires jrails. Otherwise RJS generates prototype
code. I just started using jrails and jquery-rails together and they work fine. I have to use jrails because my app has many RJS files.
In general, people who switched to jQuery write pure JavaScript code. They do not use RJS at all so jrails is not needed. Instead of RJS, ERB templates are used. E.g.
$('#foo').html("<%= escape_javascript(render "bar") %>");
Rails has the concept of a "javascript driver", which can be replaced with any javascript library. By dafault it uses prototype, but if you install jquery-rails, it removes the JS driver for prototype, and adds the jQuery driver.
So you can still run rjs with jQuery, as the driver is different, and will output jQuery commands, rather than prototype.
About the jQuery version, you're confusing jQuery with jQueryUI. The last version of jQuery is 1.5.1 (and I think jQuery-rails has 1.5), and the latest of jQueryUI is 1.8.10. jQuery UI is an extension of jQuery, which includes mouse interaction, more effects, themes and other goodies.
If you're new to jQuery, I strongly suggest you to read jQuery in Action. It's an amazing introduction to jQuery and jQueryUI.... definitely worth every penny.
精彩评论