Created
December 10, 2015 17:12
-
-
Save ascruggs/dd7e794e509098b3f7fb to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Teacher < ActiveRecord::Base | |
has_many :courses | |
has_many :lightbulbs, :through => "courses" | |
end | |
class Course < ActiveRecord::Base | |
has_many :lightbulbs | |
end | |
class Lightbulb < ActiveRecord::Base | |
end | |
teacher = Teacher.find 1 | |
teacher.courses | |
#I thought the relationships were more complicated than this, but it maps to the example you send and hopefully illustrates the point |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment