I'm bulding a rails 5.1.x app so no jQuery, but I'm usining Bootstrap so I added it in.
I was adding in
//= require jquery and
//= require jquery_ujs, then noticed that rails 5.1 now ships with
//= require rails-ujs. My initial reaction is
rails-ujs replaces the need for
jquery_ujs so I don't need it.
My question is, will I run into any problems with jQuery if I do not include
//= require jquery_ujs ?
Thanks for the help!
I did an episode on the new Rails UJS library. It replaces everything jquery_ujs does, but it just doesn't require jQuery: https://gorails.com/episodes/rails-ujs-primer
Feel free to add jquery in, but you won't need the jquery_ujs library. Everything will still function exactly the same as before, they just want to reduce dependencies.
My lazyness has been exposed! I didn't even bother to search the videos, haha!
Thanks for the help Chris! You're the man!
Hi, I am using the
smart_listing gem and without requiring
jquery_ujs I am getting some js errors. Probably
smart_listing can be fixed. What i am trying to say is that there might be some compatibility issues with existing libraries.
P.S. so far I've removed
rails_ujs and I'm only using
jquery_ujs. So far no compat issues I see.
Update: actually if I enable both of them, then requests are processed twice instead of once. That means click form submit once but it is submitted twice. So one has to enable only one -
@Alexander Kostadinov: yep, same result. you only need
require rails_ujs, otherwise if you are doing any type of submission from client (for example), an alert will process twice.
Join 30,005+ developers who get early access to new screencasts, articles, guides, updates, and more.