Skip to content

Instantly share code, notes, and snippets.

@ianks
Created February 4, 2015 00:42
Show Gist options
  • Save ianks/367e48232e89a3639284 to your computer and use it in GitHub Desktop.
Save ianks/367e48232e89a3639284 to your computer and use it in GitHub Desktop.
module Api
module V1
class ConfirmationsController < Devise::ConfirmationsController
def show
self.resource = User.confirm_by_token params[:confirmation_token]
yield resource if block_given?
domain = Rails.application.secrets.domain_name
navigate_to_after_confirmation_path resource, domain
end
private
def navigate_to_after_confirmation_path(resource, domain)
if resource.errors.empty?
respond_with_navigational(resource) do
redirect_to domain, notice: ''
end
else
respond_with_navigational(
resource.errors,
status: :unprocessable_entity
) { redirect_to domain }
end
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment