ruby - Rails 4, Turbolinks 3, Partial Replacement -


how use new turbolinks 3.0 (branch: 'master') rails 4.2?

i'm trying , got chrome error:

uncaught syntaxerror: unexpected token :

if use partial replacement this:

<%= link_to "something", root_path %> 

and in same page:

<script> turbolinks.visit(url, { change: 'areadiv' }); </script> 

according docs: https://github.com/rails/turbolinks#partial-replacements-with-turbolinks-30

the page reloaded entirely , got error. how do?

edit day after

i have rails 4.2.1 standard.

in gemfile added:

gem 'turbolinks', :github => 'rails/turbolinks', :branch => 'master' 

now in 1 controller have:

def ok_category       render plain: "ok", change: 'categoriesdiv'   end 

or maybe this:

 def red_category       redirect_to "http://www.google.com", change: 'categoriesdiv'   end 

or this:

def red_category       render partial: 'category_choose', change: 'categoriesdiv'   end 

also if add , turbolinks: true @ end of each line, nothing!

my chrome window's title changing in laconic "undefined", if use chrome developer tool says me in "network" tab request server complete "get" method, "304" status, "text/javascript" type, without errors.

in application.html.erb have:

<!doctype html> <html> <head> <meta charset="utf-8"> <meta http-equiv="x-ua-compatible" content="ie=edge"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>hello!</title>   <%= stylesheet_link_tag    'application', media: 'all', 'data-turbolinks-track' => true %>   <%= javascript_include_tag 'application', 'data-turbolinks-track' => true %>   <%= csrf_meta_tags %> </head> <body> <div class="container">  <div id="test"><%= time.now.to_s %></div> <div id="links"><%= link_to "testmylink", ok_category_path(1), remote:true %></div>  <%= yield %>  <div id="categoriesdiv" data-turbolinks-temporary>yes yes!</div> <footer class="footer">   <p class="text-center">hello!</p> </footer> </div> </body></html> 

what wrong me?

turbolinks tricky, either way here resource worth spending time on. see slight syntax differentiation between write , how do.

https://github.com/rails/turbolinks/issues/448


Comments