Search code examples
jqueryruby-on-railsrubyasset-pipelineassets

How to include "jquery_ujs" with disabled pipeline to be able to use "remote: true" for forms?


I'm not using assets pipeline. I included a normal jquery file by referring it as "jquery":

<script src="jquery.js"></script> 

How can I do the same thing for "jquery_ujs", what's the proper file name and where can I do it exactly? I want to call a form with remote: true. Do that require jquery_ujs?


Solution

  • If you don't include asset pipeline to your project, then adding jquery_ujs is required.When using asset pipeline, rails provides half of the javascript required through its helpers.

    Now in your case we will have to add the following, either in your application.html or on top of the .html.erb file where you have the form,

    <script src="/assets/jquery.js"></script> 
    <script src="/assets/jquery_ujs.js"></script>