I will post it for those who have similar troubles because it was difficult to find a way to prevent screen transitions when creating likes and comments functions only with Rails.
ruby 2.6.3
Rails 5.2.4.3
redirect_to request.referer
Let's put this one line at the end of the controller. That way, the screen will not change even after you press the button!
If you want to know more about redirect_to, I recommend the material here.
Recommended Posts