I have googled around a bit, but haven't been able to figure out what the exact difference between the two is. From the jquery-rails read me (https://github.com/indirect/jquery-rails) it seems that jquery-ujs complements it, but I'm not sure why/how.
Would appreciate it if someone could break this down to me.
Thanks.
The jquery-rails gem contains all 3 jQuery versions. You can use jQuery 1, 2, and 3 by requiring jquery, jquery2, and jquery3 on application.
jquery-ujs is a script, originally created for Ruby on Rails, to simplify common JavaScript actions and make it easier to execute RESTful actions through links. Even though it was created for Rails, it works perfectly with Laravel.
jquery-ujs is the unobtrusive implementation to allow you to use jQuery in a Rails app. Simply speaking, it's just a single rails.js. To use it, you have to get jQuery and setup your Rails app.
jquery-rails is the gem to do this for you, it bundles (in its own vendor/assets directory) the most recent jQuery, jQuery-UI and jquery-ujs lib. I suggest you use it directly.
Update: you can checkout the vendor/assets/javascripts directory here:
https://github.com/rails/jquery-rails/tree/master/vendor/assets/javascripts
Under it sit the most recent jquery, jquery-ui and jquery_ujs(identical to the rails.js in jquery-urj project).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With