开发者

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

resources :cimgs, :path => :pics, :as => :pics

match '/enviar'开发者_StackOverflow中文版     => 'cimgs#new',         as: 'new_pic'

When I call new_pic_path I keep getting /pics/new instead of /enviar

How should I do?


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


write the below code above like:

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


First you can write match '/enviar' => 'cimgs#new', as: 'new_pic' above resources :cimgs, :path => :pics, :as => :pics; second - read this: Rails routing

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜