0

我的观点是用户展示页面

<%= link_to 'Cancel?', {:url => schedule_path,
                        :id => current_user.schedules[0].id,
                        :confirm => "are you sure?",
                        :method => :delete} %>

协会

has_many :schedules
belongs_to :user

路线.rb

resources :schedules 
resources :users  

我不匹配 routes.rb 中的任何内容。堆栈跟踪中的参数显示id=> 93,这是我想要的,因为我试图销毁 id 为 93 的计划。但是当我想要计划控制器的销毁操作时,它会路由到用户控制器的显示操作。谢谢你的帮助。

4

1 回答 1

3

尝试link_to 'Cancel?', schedule_path(current_user.schedules[0]), :confirm => "are you sure?", :method => :delete

于 2011-11-09T14:46:22.470 回答