In my Rails app I’ll have the following relationships:
class Location < ActiveRecord::Base; end
class Park < Location; end
class Campground < Location; end
class Trails < Location; end
My goal is to be able to link all of specific types of locations together. For example, if I select a park, I would like to be able to see all the campgrounds and trails that are related to the park. Likewise, if I were to select a Trail or a Campground, I would like to be able to find the other types of locations that are related to the Trail or Campground.
Any ideas how I might achieve this?
Thanks for looking
Depending on how you want them to be related, you will probably need a separate relationship/table to store that information. For example, you could do something like this:
Then to find other “locations” in the same location group (of which it could belong to several):
Hope that helps give you some ideas!