File this under mild pedantry, but it’s been bugging me. Assume I want
to store different kinds of fruit in an STI table. My approach works,
but I end up referring to “fruit_bases” throughout my code where I’d
really prefer just “fruits”.
What I’ve got is something like:
create_table “fruit_bases” do |t|
class Base < ActiveRecord::Base
# code common to all fruit
class Apple < Base
# apple specific code
class Basket < ActiveRecord::Base
Instinct tells me that my table should be named simply “fruits”, and
that a Basket has_many :fruits, not :fruit_bases.
What’s the rails-y way to accomplish that?