Forum: Radiant CMS copy pages

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Todd McGrath (Guest)
on 2007-02-26 22:02
(Received via mailing list)
Hi,

Does anyone have a recommendation for copying existing pages from one
parent to
another?

I'm doing it against the database directly (sql, export, import), but
I'm hoping
for a more efficient way.

Todd
Sean C. (Guest)
on 2007-02-26 22:04
(Received via mailing list)
Todd,

Do you want to copy them or just move them?  Moving them is fairly
trivial with script/console.

Sean
Todd McGrath (Guest)
on 2007-02-26 22:09
(Received via mailing list)
Hi Sean,

I need to copy em

BTW- radiantcms.com is down?

Todd

Quoting Sean C. <removed_email_address@domain.invalid>:
David Minor (Guest)
on 2007-02-26 22:27
(Received via mailing list)
On Feb 26, 2007, at 2:08 PM, Todd McGrath wrote:

> BTW- radiantcms.com is down?

yes, it's not just you.
Sean C. (Guest)
on 2007-02-26 22:35
(Received via mailing list)
Todd,

Yes, I asked John about it, and TextDrive is having issues with the
server. (radiantcms.org)

There's not a trivial way to do a deep-copy of a page, but I'll outline
the process for you.

1) Open script/console production (assuming you're running in production
mode-- I hope)
2) Use Page.find to get the original page that you intend to copy.
3) Clone the original page (original.clone).
4) Assign the parent or parent_id of the cloned page.
5) Iterate through all the page parts of the original page, clone them,
and add them as parts to the cloned page.
6) Save everything.

Sean
John W. Long (Guest)
on 2007-02-27 18:48
(Received via mailing list)
Todd McGrath wrote:
> BTW- radiantcms.com is down?

It's back up now.

--
John L.
http://wiseheartdesign.com
This topic is locked and can not be replied to.