Forum: Ruby on Rails model

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
C7da1c726f89b6b7c37e8a22c0e0382d?d=identicon&s=25 Amita Bhatkhande (amita0204)
on 2009-05-01 08:09
Hi,

Should every model have an associated table in database? I have a model
as a subclass of another model class. I am getting 'MySQL gone away'
error while creating a new object of this subclass.

Any clues?

-
Amita.
81b61875e41eaa58887543635d556fca?d=identicon&s=25 Frederick Cheung (Guest)
on 2009-05-01 09:53
(Received via mailing list)
On May 1, 7:09 am, Amita Bhatkhande <rails-mailing-l...@andreas-s.net>
wrote:
> Hi,
>
> Should every model have an associated table in database? I have a model
> as a subclass of another model class.


not necessarily. For example when using single table inheritance then
a model and its subclasses will share a table, and you can of course
have non-activerecord model classes that don;t use the database at
all.

Fred
Aafa8848c4b764f080b1b31a51eab73d?d=identicon&s=25 Phlip (Guest)
on 2009-05-01 15:15
(Received via mailing list)
> I am getting 'MySQL gone away'
> error while creating a new object of this subclass.

Refactor the common code between your tabled and table-less *models into
a
module, and let both models include that module.

*yes, it's still a model, even if it has no DB persistence.

--
   Phlip
   http://flea.sourceforge.net/resume.html
This topic is locked and can not be replied to.