Displaying 2 results from an estimated 2 matches for "contentpage".
Did you mean:
content_page
2007 Oct 18
4
Polymorphic Association?
...t I''d like is to have a
Content Page which consists of a series of Content Blocks. The
Content Blocks act as a list relative to the Content Page. And each
Content Block can be assigned one of 3 types of content: TextContent,
ImageContent, or FileContent. So my current thinking is this:
ContentPage
has_many :content_blocks, :order => :position
ContentBlock
belongs_to :content_page
acts_as_list :scope => content_page_id
has_one :text_content
has_one :image_content
has_one :file_content
TextContent
belongs_to :content_block
ImageContent
belongs_to :content_block
FileCo...
2007 May 29
0
STI and Active Record
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 =...