How do I structure a Bookings table for two models?
I've primarly built out support to book a flight, and now I'm looking to offer the ability to book a hotel as well. I'm looking for some insight on the best way to model this:
Currently there is a Reservations table that has a flight_id
and user_id
. Does it make sense to create an entirely new table for Hotel reservations, or modify the exisiting Reservations table to support polymorphic assocaitons? Instead of flight_id
, it would have a reservable_type
and reservable_id
. Off the top of my mind, ActiveRecord will be unable to build any join from a polymorphic assocation without additional information.