Forum: Ruby on Rails STI and Active Record

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.
B2721cc23cfb835d957b886c7885abac?d=identicon&s=25 Mike (Guest)
on 2007-05-29 20:25
(Received via mailing list)
Hey,

I'm trying to use STI in my models, while writing a little cms.
A have a model called Page and some subclasses like ContentPage,
Sysfolder etc. Some classes share similar attributes, so I use STI and
one table for all types.
Now I'm writing a form for edititing a page and I want to have the
opportunity to change the type of it at runtime. But that seems to be
a problem:

When I say:

page = Page.find(x)
page.type = ContentPage
This topic is locked and can not be replied to.