Reputation: 895
I've been looking at underscore.js and wanted to add it to my rails project. I'm already using jQuery. Is there a best practice when it comes to using these two libraries together? Also, how do you deal with jQuery objects with underscore? Do you use jquery to select a bunch of elements, then run them through underscore?
Upvotes: 1
Views: 2528
Reputation: 5941
I suggest you to use it without underscore-rails
gem. It is very useless.
It produce nothing but new dependency for the project.
There is no reason to scare using the underscore.js
directly.
Upvotes: 1
Reputation: 21
You can either manually include the underscore js file in your assets, or you can use this gem:
https://github.com/rweng/underscore-rails
Underscore works well with Javascript collections and objects of any kind, so the functions do work well with jQuery objects.
Upvotes: 1