Skip to content

Instantly share code, notes, and snippets.

@GAierken
Last active February 3, 2020 17:00
Show Gist options
  • Save GAierken/034286c56910da5b75d1bd2adc42b9bd to your computer and use it in GitHub Desktop.
Save GAierken/034286c56910da5b75d1bd2adc42b9bd to your computer and use it in GitHub Desktop.
class User < ApplicationRecord
has_many :provider_appointments, foreign_key: :client_id, class_name: "Appointment"
has_many :providers, through: :provider_appointments
has_many :client_appointments, foreign_key: :provider_id, class_name: "Appointment"
has_many :clients, through: :client_appointments
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment