Zequez
Zequez

Reputation: 3499

How do I replace the default url/path REST helpers in Ruby on Rails?

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

Answers (3)

Bohdan
Bohdan

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

bor1s
bor1s

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

Dnyan Waychal
Dnyan Waychal

Reputation: 1418

write the below code above like:

match '/enviar'     => 'cimgs#new',         as: 'new_pic'
resources :cimgs, :path => :pics, :as => :pics

Upvotes: 1

Related Questions