I have a table of companies and a join table forming the relationship
between a list of possible services they can provide.
Working from a basic understanding of OOP I assumed that there should be
a series of Serviceprovider child objects of the company class.
Company < ActiveRecord::Base
Serviceprovidertype1 < Company
Serviceprovidertype2 < Company
These child classes have corresponding child controllers
Serviceprovidertype1Controller < CompanyController
in the parent I have a method
Company.find_by_sql(… + service + …)
and in the child Serviceprovidertype1Controller
but it only seems to work if I make the method in the parent a class
I don’t understand why the child just doesn’t inherit the parent method,
and why a class method should - I’ve read it’s used when you want it
to apply the same to all object instances ie
count_the_number of companies
Can anyone explain what I’ve obviously misunderstook, is my appraoch
using inheritance in this manner inappropriate ?