turbolinks / turbolinks-classic

Classic version of Turbolinks. Now deprecated in favor of Turbolinks 5.
MIT License
3.54k stars 428 forks source link

Partial replacement with div content not working #644

Open anuj-dhanju opened 8 years ago

anuj-dhanju commented 8 years ago

I have tried with both way "Client-side partial replacement", "Server-side partial replacement" but its not working. Its render the page but not replacing the div content. Gemfile: gem 'turbolinks', :github => 'rails/turbolinks', :branch => 'master'

My code is.. def test render :test, change: ['tabs'] end

view index.html.slim = link_to "render test in tabs", test_users_path

tabs.tab-pane

Expected : When I will click on "render test in tabs" link, test action partial should be render in "#tabs".

caike commented 8 years ago

It took me some time to understand this as well. Here's how you can make it work: First, change your link to use xhr, like:

= link_to "render test in tabs", test_users_path, remote: true

Then, make sure your test view template also has a div with id tabs. That should be all!

a-barbieri commented 8 years ago

The documentation is not so explicit and I cannot make @caike suggestion to work. I'm having hard time as well understanding how this works.

Did you find a way to sort that out? Is there any hope or should I just drop it? I just want to load content asynchronously but maybe it's not the right tool.