Skip to content

Instantly share code, notes, and snippets.

@codenamev
Created January 11, 2018 13:46
Show Gist options
  • Save codenamev/94b062a6f0fe0bfea263e951725d15e8 to your computer and use it in GitHub Desktop.
Save codenamev/94b062a6f0fe0bfea263e951725d15e8 to your computer and use it in GitHub Desktop.
Woofers Modelling
class User < ApplicationRecord
has_many :dogs
end
class Dog < ApplicationRecord
belongs_to :user
end
class User < ApplicationRecord
has_many :dogs
has_many :dog_walkers
end
class Dog < ApplicationRecord
belongs_to :user
end
class DogWalker < ApplicationRecord
belongs_to :user
has_many :dogs
end
class Owner < Application Record
belongs_to :user
has_many :dogs, through: :user
end
class User < ApplicationRecord
has_many :dogs
has_many :dog_walkers
has_many :owners
has_many :dog_walkers
end
class Dog < ApplicationRecord
belongs_to :user
end
class DogWalker < ApplicationRecord
belongs_to :user
end
class Owner < Application Record
belongs_to :user
has_many :dogs, through: :user
end
class DogTrainer < ApplicationRecord
belong_to :user
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment