Created
February 4, 2015 00:42
-
-
Save ianks/367e48232e89a3639284 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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