bigpotato
bigpotato

Reputation: 27537

Rails 2 routes.rb: :except not working with block

I need to remove the index action from this route. This is my original code:

    map.resources :pages, :member => { :confirm_delete => "get" }, :new => { :save_sort => :post } do |pages|
            pages.resources :pages
            pages.resources :sections
    end

and I tried this (notice there are 2 :except options there, I tried it individually as well) but it doesn't work:

    map.resources :pages, :member => { :confirm_delete => "get" }, :new => { :save_sort => :post }, :except => [:index] do |pages|
            pages.resources :pages, :except => [:index]
            pages.resources :sections
    end

Any advice?

Upvotes: 1

Views: 59

Answers (1)

bigpotato
bigpotato

Reputation: 27537

I ended up just going to the index action of my pages controller and adding a raise ActionController::RoutingError.new('Not Found'). Goes one level deeper but the result is the same nonetheless.

Upvotes: 2

Related Questions