Forum: Ruby on Rails RESTful acts_as_tree

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Andrei E. (Guest)
on 2008-11-13 13:36
(Received via mailing list)

I was trying to use the acts_as_tree plugin and I got stuck when
trying to do it in a RESTful way. I have a Place model that can have
and belong to other places. What is the correct method of creating new
places in a RESTful way? I don't necessarily care about have an url /
place/id/place/id. I'm mostly interested to know the correct way of
passing the parent_id in order to create the new place.

This is my create method:

# POST /places
  def create
    @parent_place = Place.find(params[:place_id])
   # or do I use @parent_place = Place.find(params[:parent_id])

    @place =[:place])

    respond_to do |format|
        flash[:notice] = 'Place was successfully created.'
        format.html { redirect_to(@place) }
        format.html { render :action => "new" }

# routes.rb
 map.resources :places, :has_many => :places  # is this legal?

Some guidance would be really appreciated. Thanks
This topic is locked and can not be replied to.