Skip to content

Instantly share code, notes, and snippets.

@sameera207
Created May 8, 2012 08:56
Show Gist options
  • Save sameera207/2633710 to your computer and use it in GitHub Desktop.
Save sameera207/2633710 to your computer and use it in GitHub Desktop.
HABTM - code sample
class Treatment
has_many :treatment_treatment_types
has_many :treatment_types, :through => :treatment_treatment_types
end
class TreatmentTypes
has_many :treatment_treatment_types
has_many :treatments, :through => :treatment_treatment_types
end
class TreatmentTreatmentType
belongs_to :treatment
belongs_to :treatment_types
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment