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.
329bfa71096934d3a0c530f59577eb22?d=identicon&s=25 Todd McGrath (Guest)
on 2007-02-26 21: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
8802b1fa1b53e2197beea9454244f847?d=identicon&s=25 Sean Cribbs (Guest)
on 2007-02-26 21: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
329bfa71096934d3a0c530f59577eb22?d=identicon&s=25 Todd McGrath (Guest)
on 2007-02-26 21:09
(Received via mailing list)
Hi Sean,

I need to copy em

BTW- radiantcms.com is down?

Todd

Quoting Sean Cribbs <seancribbs@gmail.com>:
Ff2c500b4f2690c6e60d580f6b3caf78?d=identicon&s=25 David Minor (Guest)
on 2007-02-26 21: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.
8802b1fa1b53e2197beea9454244f847?d=identicon&s=25 Sean Cribbs (Guest)
on 2007-02-26 21: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
6ec6f77ea603dd75b3a7a7775b059e79?d=identicon&s=25 John W. Long (Guest)
on 2007-02-27 17:48
(Received via mailing list)
Todd McGrath wrote:
> BTW- radiantcms.com is down?

It's back up now.

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