I’m developing a project using Rails 3.2.
In the project I have a controller that manages the user profiles with the basic CRUD methods in it.
At some point I added a new method called ‘location’, used to store the user profile location. This method only respond to JSON request.
After I added this method, the redirect, after the update profile action, is not behaving as before. It should redirect to edit action, but instead I get something like:
Redirected to http://localhost:3000/profiles/1/edit
Completed 406 Not Acceptable in 367ms (ActiveRecord: 23.1ms)
The edit profile action route has not changed and if I rename the ‘location’ action everything is working fine, so I guest the method name cause this, but I do not know why. Can you help me?
locationis a method ofActionController::Metalwhich is available to your controller and you’re overriding it this way.You can retain the route
/users/:id/locationwithout the need to name the methodlocation. E.g., in yourroutes.rb:and in your
UsersController: