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" }
...
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---