New Discussion

Notifications

You’re not receiving notifications from this thread.

Polymorphic, STI, or something else?

0
Databases

I am working on an app for a real estate company.

There will be 2 resources, Listings and Rentals. They will have a lot of the same data (address, beds, baths, sqft, etc.) but also different (rent vs price, MLS number for listings, year built for listings, pets allowed for rentals, etc.)

I go back and forth weather or not these should be a polymorphic relationship of a Property, or a STI with a property type, or if there is something else that is a better way.

It seems with a polymorphic association, I have to have a lot of duplicate code (controllers and views) is that true or is there a way where most everything can be written on the Property resource?

But a STI there will be a lot of empty columns for each row.

Thoughts?

Join the discussion
Create an account Log in

Learning Ruby on Rails? Join our newsletter.

We won't send you spam. Unsubscribe at any time.