On 4 Aug 2010, at 14:15, Ned wrote:

> If anyone has an idea, or a thought of why this change was made, would
> be good to hear

It was done as part of some changes to add back support for custom new actions 
e.g. /posts/new/preview. To support this we added new scope to resources to 
match member and collection scopes. So whereas before 'new' would be added to 
the path scope, in RC it doesn't because new_scope has already added new to the 
path.

You can specify your routes as follows to get the effect you need:

  resources :sections, :id => /.+/ do
    get :new, :path => 'new', :on => :member
  end

However you'll still need to address the create, edit and update actions plus 
you'll need to override the :id constraint which doesn't allow slashes. Also 
the show action comes before the edit action so the greedy regexp needed for 
:id will match the edit url. You would be better off manually specifying each 
of the routes individually - it'll be easier than trying to bend resources to 
what you want:

  scope('sections', :controller => 'sections', :id => /.+/) do
    get    '/(:id)/new' => :new,     :as => :new_section
    get    '/:id/edit'  => :edit,    :as => :edit_section
    get    '/:id'       => :show,    :as => :section
    put    '/:id'       => :update,  :as => :section
    delete '/:id'       => :destroy, :as => :section
    get    '/'          => :index,   :as => :sections
    post   '/(:id)'     => :create,  :as => :sections
  end

This set of routes should do what you need.


Andrew

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Core" group.
To post to this group, send email to rubyonrails-c...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-core+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-core?hl=en.

Reply via email to