[Radiant] automated page building
Adam Williams
adam at thewilliams.ws
Wed May 16 05:49:54 CDT 2007
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
More information about the Radiant
mailing list