Rails model with no table?

Jacob Fugal lukfugl at gmail.com
Fri Jul 18 14:54:23 MDT 2008

On Fri, Jul 18, 2008 at 2:01 PM, Stephen Ward <sjward at gmail.com> wrote:
> The problem I'm currently trying to solve is this: there is a model
> class in this rails app that does not have a corresponding database
> table.  In fact, there is a comment in the model class code that says:
> "I admit this is a bit of a hack, since there is not [sic] 'XYZ' table
> in the db".

Is the class actually using any ActiveRecord functionality? If so,
there's got to be (or should be, anyways) some table or view
somewhere. If there's not, just remove the " < ActiveRecord::Base"
from the class definition. A model doesn't have to be derived from
ActiveRecord, it can be any plain old class. Of course, if it's not
ActiveRecord but needs persisting, you'll need to handle the
persistence on your own.

Jacob Fugal

More information about the PLUG mailing list