How to use jquery-turboLinks?

1

Currently I have a problem since jquery is not working correctly in my ruby on rails project and when I researched I realized that the document.ready does not work well in that framework, so I decided to download the patch that would be jquery-turboLinks , but once you install it and all that. I got this error.

ExecJS::RuntimeError in Inicio#index 

    Showing /home/david/Escritorio/prueba_ruby/app/views/inicio/index.html.erb where line #13 raised:

    SyntaxError: [stdin]:9:9: unexpected or

    Rails.root: /home/david/Escritorio/prueba_ruby

The line that marks me # 13 is this line of code:

<%= image_tag("1.jpg", :class=>"cloud9-item" ) %
    
asked by David 01.06.2017 в 03:21
source

1 answer

2

You have an error, you need a > at the end:

<%= image_tag("1.jpg", :class=>"cloud9-item" ) %>
                                                ^

Regarding the use of turbolinks , change this code:

$(document).ready(function() {
   // código
});

for this other:

$(document).on('turbolinks:load', function() {
  // código
});

You can see the detail in the rails guides .

    
answered by 01.06.2017 / 04:05
source