Inheritance of separate tables (where each car and truck have one database)
class Vehicle < ActiveRecord end class Car < Vehicle end class Truck < Vehicle end
In your case, you are not using a database, but rather functions. Then you have to write a module and include it in each model
class Car < ActiveRecord extend VehicleFinders end class Truck < ActiveRecord extend VehicleFinders end module VehicleFinders def find_purchased
Thus, in the extend module, the class method is the class method for this calling class. include module methods - this is an instance method for the object of the calling class
It may be useful to read for you http://raysrashmi.com/2012/05/05/enhance-rails-models
source share