Reputation: 3499
resources :cimgs, :path => :pics, :as => :pics
match '/enviar' => 'cimgs#new', as: 'new_pic'
When I call new_pic_path I keep getting /pics/new instead of /enviar
How should I do?
Upvotes: 1
Views: 138
Reputation: 8408
you might change order cause routes are matched from the top or add :except
option to the resources part
resources :cimgs, :path => :pics, :as => :pics, :except => :new
Upvotes: 2
Reputation: 4113
First you can write match '/enviar' => 'cimgs#new', as: 'new_pic'
above resources :cimgs, :path => :pics, :as => :pics
; second - read this: Rails routing
Upvotes: 1
Reputation: 1418
write the below code above like:
match '/enviar' => 'cimgs#new', as: 'new_pic'
resources :cimgs, :path => :pics, :as => :pics
Upvotes: 1