rails 4 里面 用 link_to 来生成 delete调用,
2015-12-11 13:01
531 查看
在rails 4 里面 用传统的 link_to 的写法会导致 delete 依然发出的 get 请求。从而导致 无法删除数据,已经进入的是 show方法
传统的写法
<%= link_to ‘Destroy’, :action => ‘destroy’, :id => user.id %>
正确的写法
<%= link_to 'Delete', user , method: :delete%>
传统的写法
<%= link_to ‘Destroy’, :action => ‘destroy’, :id => user.id %>
正确的写法
<%= link_to 'Delete', user , method: :delete%>
相关文章推荐
- StoryBoard页面跳转方式 Show,Show Detail,Present Modally,Present as Popover
- Naive Bayes Classification
- Daily Scrum – 12/10
- Spirng+In+Action(Craig Walls Ryan Breidenbach)
- 远东转载这说明一些有实力的话人工智能协会的思维和潜意识之间移动的一篇文章
- VMware: Taking Ownership of this Virtual Machine Failed
- 31 Which of the following is a benefit of ASM fast disk resync? A. Failed disks are taken offline im
- notify 和 notifyall 的区别,yield 和 wait,sleep的区别
- 使用行为树(Behavior Tree)实现游戏AI
- R包的安装错误ERROR: dependency ‘plyr’ is not available for package ‘reshape2’
- 行为树(Behavior Tree)实践(2)– 进一步的讨论
- VirtualBox is complaining that the kernel module is not loaded
- 行为树(Behavior Tree)实践(1)– 基本概念
- test again
- 人工智能--机器学习相关文章收集
- 【Beta】Daily Scrum Meeting第五次
- 【Beta】Daily Scrum Meeting第五次
- Horizon/DomainWorkFlow
- 15 Which tasks are run automatically as part of the Automated Maintenance Task by default? (Choose a
- LeetCode 220 Contains Duplicate III