# Quick and Dirty Parent Change Hack

**URL:** <https://www.ruby-forum.com/t/quick-and-dirty-parent-change-hack/78841>\
**Category:** Radiant CMS\
**Created:** [December 9, 2006, 2:14am UTC](https://www.ruby-forum.com/t/quick-and-dirty-parent-change-hack/78841 "2006-12-09T02:14:40Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ethan\_Winn](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/e5b9ba/32.png) [@Ethan\_Winn](https://www.ruby-forum.com/u/Ethan_Winn)\
**Post date:** [December 9, 2006, 2:14am UTC](https://www.ruby-forum.com/t/quick-and-dirty-parent-change-hack/78841/1 "2006-12-09T02:14:40Z")

</div>

It’s surprisingly easy to add “Change Parent” functionality to Radiant  
0.5.2(as requested in  
[http://dev.radiantcms.org/radiant/ticket/47](http://dev.radiantcms.org/radiant/ticket/47)). I just added these lines  
at  
line 78 of views/page/new.rhtml:

```
    <tr>
      <td><label for="page_parent_id">Parent</label></td>
      <td class="field"><%= select "page", "parent_id", 

```

(Page.find(:all,  
:order =\> “title ASC”).map { |s| [s.title, s.id] }) -  
[@page.title,@page.id]  
%\>

This really isn’t enough for release. Ideally the page list would be  
nested  
and the order identical to that of the index. I’d like to clean this up  
and  
make it a patch, but since I may never get around to it and so it’s out  
there here it is. If you want to be able to change parents quick without  
going into the DB, this seems like a pretty straightforward solution.  
Any  
ideas on how best to display the names nested? (I guess really this  
means  
prefixing each name with a number of “-” characters equal to the number  
of  
parents it has…)

Ethan

DIFF:

77a78,81

> ```
> <tr>
> <td><label for="page_parent_id">Parent</label></td>
> <td class="field"><%= select "page", "parent_id", (Page.find(:all,
> 
> ```

:order =\> “title ASC”).map { |s| [s.title, s.id] }) -  
[@page.title,@page.id]  
%\>
