Open matthewmcgarvey opened 3 years ago
Wow, yeah I've read these docs but the fact that you needed one foreign key per possible association will make it pretty much impossible to take an ActionText or ActiveStorage approach for libraries in the future.
I actually really dislike how those libraries structure the DB so that doesn't bum me out, but it's a great catch to address that up front, loud and clear.
https://luckyframework.org/guides/database/models#polymorphic-associations
Coming from rails, I was reading the guide assuming the table had a
assoc_type
andassoc_id
columns but the way Lucky accomplishes the polymorphic relationship is by having a nilable column for each different type and handles the polymorphism at the code layer.A better explanation of the database layout would make it more clear.
Maybe even bonus points if we lay out how why Lucky can't do polymorphic associations like Rails does since we are statically typed.