How to redirect from rails controller update action after a client (react) update?

298 Views Asked by At

So I feel like this should be straightforward. I am using the react-rails gem to use some react in my rails app when needed. In this case, I am rendering a react_component form in the edit view. Once the update is complete (which takes place in react using axios), I want to use the rails controller to redirect to the index view which is not a react component. I would think a simple redirect to would work example:

redirect_to users_path, notice: 'Update successful.'

But when my update is completed, the redirect thinks it is a 'put' request and fails with 404

PUT http://localhost:3000/users 404 (Not Found)

Is it possible to redirect from the rails controller? If not, what is the work around?

EDIT: fixed type user_path to users_path

0

There are 0 best solutions below