I recently started developing a REST API with rails 5. I'm trying to perform user custom actions through API calls. I created the main application for users.
In my routes, I have the following:
Rails.application.routes.draw do
devise_for :users, :controllers => {sessions: 'sessions', registrations: 'registrations'}
end
I created two separate session_controller and registrations_controller controllers to override the development methods and force it to accept the JSON format.
class RegistrationsController < Devise::RegistrationsController
respond_to :json
end
and
class SessionsController < Devise::SessionsController
respond_to :json
end
I am trying to register a user submitting the following data:
{
user: {
email: me@gmail.com,
password: password,
password_confirmation: password
}
}
I get status 200. But on my rails server, I get the following error:
Started POST "/users" for 23.233.9.94 at 2016-12-22 08:22:11 +0000
Processing by RegistrationsController
Parameters: {"Payload: { \r\n user: {\r\n email: me@gmail.com,\r\n password: password,\r\n password_confirmation: password\r\n }\r\n}"=>"[FILTERED]"}
(0.2ms) begin transaction
(0.1ms) rollback transaction
Completed 200 OK in 5ms (Views: 0.2ms | ActiveRecord: 0.3ms)
, 2 .
JSON , .
, CSRF. .
.