我正在try 创建一个到我的用户控制器的销毁链接,我也在使用Desive.
这是我的密码-
看法
<%= link_to 'Delete User?', child, :confirm => "Are you sure you want to delete #{child.full_name}?", :method => :delete, :class => "user-additional", :style => "font-size:12px;font-weight:normal;" %>
控制器
def destroy
if @user = User.find(params[:id])
@user.destroy
respond_to do |format|
format.html { redirect_to account_index_path }
format.xml { head :ok }
end
end
end
路由
devise_for :users
resources :users, :except => [:new]
链接转换为localhost:3000/users/10
单击此按钮将打开用户显示,而不是删除他们
有什么 idea 吗?