The equivalent of what you've written is currently performed by abstract_model_controller in handle_new_or_edit_post
as: model.attributes = params[model_symbol] which for the case of page is essentially: @page.attributes = params[:page] The problem with hooking in to this behavior is that in order to save the page parts we need to look at: params[:parts] Supporting your suggestion would require much more broad sweeping changes. On 6/4/07, Sean Cribbs <[EMAIL PROTECTED]> wrote: > 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: [email protected] > > Search: http://radiantcms.org/mailing-list/search/ > > Site: http://lists.radiantcms.org/mailman/listinfo/radiant > > > > > > _______________________________________________ > Radiant mailing list > Post: [email protected] > Search: http://radiantcms.org/mailing-list/search/ > Site: http://lists.radiantcms.org/mailman/listinfo/radiant > _______________________________________________ Radiant mailing list Post: [email protected] Search: http://radiantcms.org/mailing-list/search/ Site: http://lists.radiantcms.org/mailman/listinfo/radiant
