Skip to content

Instantly share code, notes, and snippets.

@damien
Created June 15, 2012 00:05
Show Gist options
  • Save damien/2933745 to your computer and use it in GitHub Desktop.
Save damien/2933745 to your computer and use it in GitHub Desktop.
email_verification = CompanyEmailVerification.find_or_initialize_by_company_id_and_user_id(
user_id: current_user.id,
company_id: params[:id].to_s
)
if email_verification.persisted?
email_verification.send_verification_email
return render json: { success: true }
end
email_verification.uses_email = true
if email_verification.save
render json: { success: true }
else
render status: :not_acceptable, json: {
success: false,
errors: email_verification.errors
}
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment