Rails: how to set json format for redirect_to

json, redirect, routes, ruby, ruby-on-rails

Solution

I read apidock some more... It was quite simple. I just should specify format in path helper like this:

redirect_to user_path(@user, format: :json)

Problem

How I can redirect not to html format but to json? I want smthing like this: ``` redirect_to user_path(@user), format: :json ``` But this doesn't work, I still redirected to html path.

Original source

Related problems