Is there any way of getting the nice url methods such as new_page_path
that you get when you declare
Here is my situation:
I have a Page model with lots of pages that use acts_as_list. This
means that some of the pages are root pages - these are my site’s
sections (tabbed navigation). I would like the urls to look like this:
This will take you to a page called ‘awesome-post’ that is a child of
a page called blog. Each page has a parent page (the ‘page_id’ field
in the database).
In routes.rb, I have:
map.page ‘:section/*pages’, :controller => ‘pages’, :action => ‘show’
This works fine and gives me access to params[:section] and an array,
params[:pages] which can be used to find the page I am looking for.
What I want to be able to do is create a new page that is a child of
the ‘programmers’ page using the url
I can then grab params[:pages].last.id and use this to set the page_id
in the create action.
Do I just use
map.new_page ‘*pages/new’, :controller => :pages, :action => ‘new’
Also, how do I ‘fake out’ the put and delete methods manually, if I
want to do similar things to delete pages?
Sorry for the long post.