Created
July 14, 2017 09:55
-
-
Save roryfranklin/c0609526fd2dd5cac9857dbeb8d79eca to your computer and use it in GitHub Desktop.
Car Review and Ownership modelling
This file contains 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 Car < ApplicationRecord | |
belongs_to :user | |
end |
This file contains 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 Review < ApplicationRecord | |
belongs_to :author, class_name: 'User' | |
end |
This file contains 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 User < ApplicationRecord | |
has_many :cars | |
has_many :reviews | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment