wedding-planner/app/controllers/users/confirmations_controller.rb

23 lines
568 B
Ruby
Raw Permalink Normal View History

2024-11-30 18:14:58 +00:00
# Copyright (C) 2024 Manuel Bustillo
2024-11-30 18:46:25 +01:00
class Users::ConfirmationsController < Devise::ConfirmationsController
clear_respond_to
respond_to :json
def show
super do |resource|
if resource.errors.empty?
respond_to do |format|
format.json { render json: resource, status: :ok }
format.any { redirect_to root_path }
end
2024-11-30 18:46:25 +01:00
else
render json: {
message: 'Record invalid',
errors: resource.errors.full_messages
}, status: :unprocessable_entity
end
return
end
end
end