# Nested set - problems when creating child item

**URL:** <https://www.ruby-forum.com/t/nested-set-problems-when-creating-child-item/160881>\
**Category:** Rails\
**Created:** [February 20, 2009, 4:18pm UTC](https://www.ruby-forum.com/t/nested-set-problems-when-creating-child-item/160881 "2009-02-20T16:18:51Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![cassiozen](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/ed655f/32.png) [@cassiozen](https://www.ruby-forum.com/u/cassiozen)\
**Post date:** [February 20, 2009, 4:18pm UTC](https://www.ruby-forum.com/t/nested-set-problems-when-creating-child-item/160881/1 "2009-02-20T16:18:51Z")

</div>

Hi,

I’ve created a Model with Better Nested Set, but i’m having problems  
to create child items

My workflow is:

- In the (new) form, i pass the desired parent\_id in a hidden field.
- In the create action, i create the register and after saving it i  
use the move\_to\_child\_of method.

Everything works! My only problem is that Rails warns that I can’t  
mass asign the property “parent\_id”

How can i avoid this warning? Below is my create action:

def create  
@invite = Invite.new(params[:invite])  
begin  
@parent\_invitee = Invite.find\_by\_id(params[:invite][:parent\_id])  
rescue Exception =\> exc  
logger.error(“Invalid parent\_id: #{exc.message}”)  
render :action =\> “new”  
end  
respond\_to do |format|  
if @invite.save  
@invite.move\_to\_child\_of(@parent\_invitee.id)  
flash[:notice] = ‘Invite was successfully created.’  
format.html { redirect\_to :action =\> “show” }  
…
