Skip to content

Instantly share code, notes, and snippets.

@qizwiz
Created February 20, 2020 15:06
Show Gist options
  • Save qizwiz/590d9bc3540b8bcb27b5cd5acf1ce81e to your computer and use it in GitHub Desktop.
Save qizwiz/590d9bc3540b8bcb27b5cd5acf1ce81e to your computer and use it in GitHub Desktop.
def email_task_link(task)
product = task.product
practice = task.patient.practice
patient = task.patient
types = %w(sm_dso_doctor_setup_review_approve_order_aligner assign_clinical_advisor select_package_type)
options = [
{ link: 'task_setup_review_url', args: %i(practice task) },
{ link: 'edit_practice_patient_url', args: %i(practice task) },
{ link: 'new_order_url', args: %i(practice patient) }
]
kinds = [types, options].transpose.to_h
byebug
case task.kind
when types
send kinds[task.kind][:link].to_sym, *kinds[task.kind][:args]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment