0

I need to match /entries/slug-here/new and send it to EntriesController#new

Tried following ways, both didn't work :(

resources :entries do
  member do
    get :new
  end
end

resources :entries do
  get :new, :on => :member
end

Temporary hardcoded paths with bunch of matches, but it looks ugly >.<

UPDATED:

Same with create method and any other canonical actions -- couldn't redefine them.

pleax
  • 1
  • 1
  • i think it should be collection, since member requires an id, right? http://railsnotes.com/5-collection-member-methods-within-a-route/ – corroded Sep 25 '10 at 02:30
  • I have requirement to use part of url as slug. But couldn't configure routes through resources this way. – pleax Sep 25 '10 at 02:58

1 Answers1

0

Not sure why you need to do something like that, but in any case it should be something like this in your routes.

match '/entries/:slug/new' => 'entries#new'
Martin
  • 11,216
  • 23
  • 83
  • 140