+1 for model.association_name.build
Sean
On 5/16/07, Adam Williams <[EMAIL PROTECTED]> wrote:
> On May 16, 2007, at 5:16 AM, Francesco Lunelli wrote:
>
> > Saji Njarackalazhikam Hameed ha scritto:
> >> Dear Dan,
> >>
> >> Thanks very much. I put child.parts as an array.
> >> child.parts = [ body ]
> >>
> >> Now the error is while
> >> saving.
> >>
> >> child.save!
> >>
> >> ...
> > I think it should be child.parts << body
>
> I prefer the following, as it gives me the necessary associations of
> things to one another. Perhaps the other code is failing as it is
> missing the part name of "body"?
>
> ----------
> require 'config/environment'
>
> parent = Page.find_by_url('/request')
>
> 50.times do |i|
> child = parent.children.build(
> :title => "Page #{i}",
> :breadcrumb => "Page #{i}",
> :slug => "page-#{i}")
> child.parts.build(
> :content => "This is page #{i}",
> :name => "body")
> child.save!
> end
> _______________________________________________
> 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