I'd like to have a common superclass for two models in ruby, to share several methods. Let's say I want a Truck and Car inheriting from Vehicle. Here are some options:
Make
class Vehicle < ActiveRecord::Base, and haveclass Truck < Vehicleetc. But then I get errors saying I don't have a table forVehicle(and I don't want one, either).Use
module Vehicleandinclude Vehicleinclass Truck < ActiveRecord::Base. But thenattr_readerand friends don't get applied toTruck.
Thus, I want class Vehicle. How do I do this without requiring a table? I'm sure there's a standard, nice way of doing this...