self.abstract_class = true
self.table_name = ‘footable’
self.table_name = ‘bartable’
class Foo < ActiveRecord::Base
class Bar < ActiveRecord::Base
isn’t the same as what is mentioned in that posting… including the
SharedStuff module just makes those methods available to your model,
each model should still spec its own table_name. As you are set,
everything reads from ‘bartable’ if I understand the internals
I prefer the abstract class method, and have a class GenericModel, which
defines all the default behaviors for all the other models. Centralized
cache management, polymorphic join management, all that ugly stuff you
don’t want to type more than once.
Every other model inherits from GenericModel, overriding default
behaviors if necessary. But GenericModel has no data fields, no table
names, just methods.
I also use a GenericController, and for almost all of my other
controllers, they contain nothing more than a before_filter, sometimes a
different layout, and any actions unique to their model. index, new,
edit, save, update… they all reside in GenericController. Actions not
done by all controllers, like deep copy, or PDF generation are in each
controller that supports it.