Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

has_many associations

  • Loading branch information...
commit 499a53055aab7efa5b646367c6d3936997ab691d 1 parent b1c4dca
@gsterndale gsterndale authored
View
1  app/models/organization.rb
@@ -1,2 +1,3 @@
class Organization < ActiveRecord::Base
+ has_many :users
end
View
2  app/models/patient.rb
@@ -1,3 +1,5 @@
class Patient < ActiveRecord::Base
belongs_to :user
+ has_many :patient_authorizations
+ has_many :visits, :through => :patient_authorizations
end
View
1  app/models/patient_authorization.rb
@@ -1,3 +1,4 @@
class PatientAuthorization < ActiveRecord::Base
belongs_to :patient
+ has_many :visits
end
View
1  app/models/user.rb
@@ -1,3 +1,4 @@
class User < ActiveRecord::Base
belongs_to :organization
+ has_many :patients
end
Please sign in to comment.
Something went wrong with that request. Please try again.