RESTful acts_as_tree


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" }



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

Some guidance would be really appreciated. Thanks

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs