I’m trying to understand how best to use inheritance and wonder if
Rail’s Single Table Inheritance model too restricting.
I have a model Companies who provide 1+ Services (HABTM relationship).
I assume the best way to represent this is with a series of child models
representing each type of service : ServiceType < Company.
I want to return lists of companys for each service and then link to
show more details about them.
With the show method inherited from the Companies controller though
changing the :id on the end of the url displays the next record in the
companies table whereas I want to display the next company that also has
that service available.
I was wondering a number of things:
1/ Should be overloading the find method in the ServiceType models.
2/ a/ Should I be trying to inherit the View for Company for ServiceType
b/ by invoking Ruby’s super keyword somehow.
3/ Would it be better to have individual db table representing each
will the extra properiies that each ServiceType has in addition to the
inherited Company properities require this