turbolinks / turbolinks-classic

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

Ignore non ActionController::Base classes #606

Closed nettofarah closed 9 years ago

nettofarah commented 9 years ago

By adding this line we guarantee that the rails Engine won't include turbolinks modules into non regular controllers, such as ActionController::API (which happens to not support cookies).

Including Turbolinks into ActionControllers that don't support cookies would cause requests to error out.

ps: This could also be solved by just adding a respond_to?(:cookies) inside Turbolinks::Cookies#set_request_method_cookie, but I believe my solution is a little cleaner.

ps2: I can't really think of a decent way to write a test for this.

rails-bot commented 9 years ago

Thanks for the pull request, and welcome! The Rails team is excited to review your changes, and you should hear from @Thibaut (or someone else) soon.

If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes.

Please see the contribution instructions for more information.

nettofarah commented 9 years ago

You can reproduce this by creating a controller that inherits from ActionController::API using both edge rails and edge turbolinks.

Thibaut commented 9 years ago

Thanks for the PR. We should set up CI with rails/master so that we can add a test for this. I'll make the changes soon.

nettofarah commented 9 years ago

@Thibaut is there anything I can do on my end to help?

Thibaut commented 9 years ago

@nettofarah Not yet. I'll add CI with rails/master over the week-end so we can write a test.

Thibaut commented 9 years ago

I set up CI with rails/master but couldn't figure out a clean way to write a test either. :ship:

nettofarah commented 9 years ago

Thanks, Thibaut. On Sun, Sep 20, 2015 at 2:00 PM Thibaut Courouble notifications@github.com wrote:

Merged #606 https://github.com/rails/turbolinks/pull/606.

— Reply to this email directly or view it on GitHub https://github.com/rails/turbolinks/pull/606#event-414215496.