0

耙路线相关输出:

 colorschemes GET    /colorschemes(.:format)                 colorschemes#index
                       POST   /colorschemes(.:format)                 colorschemes#create
       new_colorscheme GET    /colorschemes/new(.:format)             colorschemes#new
      edit_colorscheme GET    /colorschemes/:id/edit(.:format)        colorschemes#edit
           colorscheme GET    /colorschemes/:id(.:format)             colorschemes#show
                       PUT    /colorschemes/:id(.:format)             colorschemes#update
                       DELETE /colorschemes/:id(.:format)             colorschemes#destroy
          choose_color GET    /choose_color(.:format)                 colorschemes#choose_color

当我使用路径助手时:

<%= link_to 'delete', colorschemes_path(@colorscheme), :method=>:delete, :remote=>true %>

输出是:Started DELETE "/colorschemes.4"

而不是“ /colorschemes/4

为什么?

4

1 回答 1

0

你需要做colorscheme_path(@colorscheme)- 单数,而不是复数!

于 2013-06-08T11:46:13.190 回答