turbolinks / turbolinks-classic

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

Server-side partial replacement not working #585

Closed patricklehmann closed 9 years ago

patricklehmann commented 9 years ago

Hi guys,

I want to submit my forms with turbolinks in rails 4.2.3 and ruby 2.1.1. i'm including turbolinks with jquery: = require jquery = require jquery_ujs = require jquery.turbolinks = require turbolinks

i use simple_for as form helper: simple_form_for [:backend, resource ], html: { remote: true, role: :form } do |f|

on my create / update action i want to redirect to collection_path so i did this in update: def update update! do success.html { redirect_to collection_path, change: 'business_vehicles' } failure.html { render :new, change: 'edit_business_vehicle_36' } end end

i can see the sending over xhr and the data are persisted. but in my browser nothing changed... can someone help me?

kind regards, patrick

javan commented 9 years ago

Your Sprockets directives for including jquery, etc., aren't formatted correctly so chances are the issue is that you're not actually bundling those libs.

They should be formatted like:

//= require jquery

Or if you're using CoffeeScript:

#= require jquery
Thibaut commented 9 years ago

Also, make sure you're using Turbolinks master. Turbolinks 3 hasn't been released yet (Rails 4.2 is still on 2.5).

patricklehmann commented 9 years ago

@javan thanks for your reply: i'm dooing something like this

/ = require ... /

@Thibaut i'll give it a try!

Thibaut commented 9 years ago

Feel free to reopen if you have reproducible steps.