[Radiant] Core Dev: Page Controller and Page Editor refactorings
Sean Cribbs
seancribbs at gmail.com
Mon Jun 4 10:56:04 CDT 2007
Jacob,
Looks like a good step in the right direction. I like your use of
association extensions. However, wouldn't it just be easier to do:
Page.new(params[:page])
or
@page.update_attributes(params[:page])
and not have to call update_associations?
Generally the strategy if you take this route is to make an
attr(_writer/_accessor) with the desired name, then an after_save
callback that saves the associated models.
Sean
Jacob Burkhart wrote:
> Hi,
>
> I've started to do some refactoring/improvment of the strucutre of
> page, page_controller, and page_parts. And I plan on continuing in a
> similar vein with admin/page/edit.rhtml
>
> The goal of this particular iteration, is to make it possible for Page
> subclasses or extensions of the Page class to add has_many,
> belongs_to, or has_one etc.. relations to Page and NOT have to modify
> page_controller. Since PageParts is a has_many of Page, I have moved
> all of the logic related to the saving of page parts into an
> association extension. Page is setup to discover all association
> extensions that respond to :update_association and pass parameters to
> and save these association appropriately.
>
> http://dev.radiantcms.org/radiant/attachment/ticket/508/page_controller_refactor.diff
> Please give me feedback on the direction I'm going!
>
> thanks,
> Jacob
> _______________________________________________
> Radiant mailing list
> Post: Radiant at lists.radiantcms.org
> Search: http://radiantcms.org/mailing-list/search/
> Site: http://lists.radiantcms.org/mailman/listinfo/radiant
>
>
More information about the Radiant
mailing list