Тот же код работает в местном, но не работает в Heroku
def update
current_user.update!(user_params)
response = { message: Message.account_updated}
json_response(response)
end
private
def user_params
params.permit(:first_name, :last_name, :email, :password)
end
routes.rb
namespace :api do
namespace :v1 do
put 'user/update', to: 'users#update'
end
end
user_serializer.rb
class UserSerializer < ActiveModel::Serializer
attributes :id, :username, :first_name, :last_name, :email, :created_at, :updated_at
end
это мой и он работает на моем локальном через Postman, то есть для обновления информации о пользователе, но пока я нажимаю на Heroku и пытаюсь обновить через Postman, затем не работает, журнал показывает вот так
2018-04-30T10:15:47.665731+00:00 heroku[router]: at=info method=PUT path="/api/v1/user/update?first_name=John&last_name=Doe" host=my-host.herokuapp.com request_id=79a84b63-be87-46f8-8fad-2d151a63722f fwd="27.147.231.22" dyno=web.1 connect=0ms service=18ms status=500 bytes=283 protocol=https
2018-04-30T10:15:47.648979+00:00 app[web.1]: [79a84b63-be87-46f8-8fad-2d151a63722f] Started PUT "/api/v1/user/update?first_name=John&last_name=Doe"
for 27.147.231.22 at 2018-04-30 10:15:47 +0000
2018-04-30T10:15:47.650866+00:00 app[web.1]: [79a84b63-be87-46f8-8fad-2d151a63722f] Processing by Api::V1::UsersController#update as */*
2018-04-30T10:15:47.650987+00:00 app[web.1]: [79a84b63-be87-46f8-8fad-2d151a63722f] Parameters: {"first_name"=>"John", "last_name"=>"Doe"}
2018-04-30T10:15:47.654619+00:00 app[web.1]: [79a84b63-be87-46f8-8fad-2d151a63722f] User Load (1.3ms) SELECT "users".* FROM "users" WHERE "users"."id" = $1 LIMIT $2 [["id", 1], ["LIMIT", 1]]
2018-04-30T10:15:47.656446+00:00 app[web.1]: [79a84b63-be87-46f8-8fad-2d151a63722f] CACHE User Load (0.0ms) SELECT "users".* FROM "users" WHERE "users"."id" = $1 LIMIT $2 [["id", 1], ["LIMIT", 1]]
2018-04-30T10:15:47.658345+00:00 app[web.1]: [79a84b63-be87-46f8-8fad-2d151a63722f] (1.1ms) BEGIN
2018-04-30T10:15:47.661446+00:00 app[web.1]: [79a84b63-be87-46f8-8fad-2d151a63722f] User Exists (1.2ms) SELECT 1 AS one FROM "users" WHERE LOWER("users"."email") = LOWER($1) AND "users"."id" != $2 LIMIT $3 [["email", "j@gmail.com"], ["id", 1], ["LIMIT", 1]]
2018-04-30T10:15:47.663630+00:00 app[web.1]: [79a84b63-be87-46f8-8fad-2d151a63722f] (1.0ms) COMMIT
2018-04-30T10:15:47.664737+00:00 app[web.1]: [79a84b63-be87-46f8-8fad-2d151a63722f] [active_model_serializers] Rendered ActiveModel::Serializer::Null with Hash (0.51ms)
2018-04-30T10:15:47.665015+00:00 app[web.1]: [79a84b63-be87-46f8-8fad-2d151a63722f] Completed 500 Internal Server Error in 14ms (Views: 1.1ms | ActiveRecord: 4.5ms)
Я думаю, что это проблема
Визуализированный ActiveModel :: Serializer :: Null with Hash (0.51ms)
Но я не понимаю, что происходит.
Обновление
module Response
def json_response(object, status = :ok)
render json: object, status: status
end
end