Hi,
Noob here, so apologies in advance for my certain misunderstandings.
I have hierarchal category structure which I've modeled using acts_as_trees. I have successfully created the code to display the categories in a tree-ish fashion (it was very easy - I'm impressed). I would like to let users add new subcategories to an existing category by clicking on a "new subcategory" link next to each category name in this tree. I am having problems doing this.
My approach has been:
In the href of the "new subcategory" html, I stick the id of the parent like this: <a href="/categories/new?parent_id=1">
I can pick up the parent_id in the new action controller easily enough: @category = Category.new @category.parent = Category.find(params[:parent_id])
But I loose it when I get to the create action controller, as the form does not have the parent_id (nor do I want it to).
The I guess my basic issue is that I set up the parent that I want to use in the list rendering, but I can't pass it all the way through to the create action.
Any suggestions?
Thanks, Alex