Rails has_many :through relationship on Address for Origins and Destinations

38 Views Asked by At

I have an Address model that I need to abstract into Origin and Destination.

class Address
  # ?
end

class Origin
  has_many :destinations
  has_many :addresses, through: :destinations
end

class Destination
  has_many :origins
  has_many :addresses, through: :origins
end
0

There are 0 best solutions below