作者catjimmy (cat)
看板Ruby
标题[问题] resources问题..delete变成show
时间Sun Sep 25 17:56:19 2011
环境:
e.g. Ruby 1.9.2 Rails 3.1.0
状况:
所有的连结都正常,唯独destroy这个连结会变成show...
route.rb的部份
resources :customers
连结的部份:
<%= link_to 'Destroy', customer, :confirm => 'Are you sure?', :method =>
:delete %>
controller的部份
def destroy
@customer = Customer.find(params[:id])
@customer.destroy
respond_to do |wants|
wants.html { redirect_to(customers_url) }
wants.xml { head :ok }
end
end
在网页按右键看原始码...
<a href="/customers/1" data-confirm="Are you sure?" data-method="delete"
rel="nofollow">Destroy</a>
检查看起来都没错呀,请问为什麽点Destroy会一直连到show呢?
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 1.160.30.55
1F:推 hellolucky:确认一下js是不是都有load到...可以看网页原始码 09/25 19:12