Rails ActiveRecord - inheriting from a base class with no table

Viewed 10894

What i'm looking to do is have a base class for some of my models that has some default activerecord behavior:

class Option < ActiveRecord::Base
  has_many :products

  def some_method
    #stuff
  end

  #etc..etc..
end

class ColorOption < Option
  #stuff...
end


class FabricOption < Option
  #stuff...
end

However, I want ColorOption and FabricOption to each be in their own tables. I do NOT want to use STI or have a table for the base class "Option". The only way I've gotten this to work is with some non-inheritance metaprogramming magic. But I wondered if there was a way to tell AR that the base class does not need a table. Its just there for extra behavior, and to put the other subclasses in their own table as usual.

Thanks, Craig

3 Answers
Related