gpt4 book ai didi

ruby-on-rails-3 - 导轨 3 :method=> :delete doesn't work in Internet Explorer

转载 作者:行者123 更新时间:2023-12-03 18:20:55 24 4
gpt4 key购买 nike

我正在阅读 railstutorial.org 上的 rails 3 教程。我刚刚创建了一个非常简单的脚手架用户。

脚手架生成的销毁链接在 Internet Explorer 中不起作用。它重定向到 show 操作而不是删除用户。

这个问题只发生在 IE9 和 IE8(到目前为止我测试过的唯一 IE 版本) Firefox 不会发生这个问题。谁能告诉我为什么会这样?

风景:

<%= link_to 'Destroy', user, :confirm => 'Are you sure?', :method => :delete %>

生成的 HTML:
<a href="/users/1" data-confirm="Are you sure?" data-method="delete" rel="nofollow">Destroy</a>

Controller :
def destroy
@user = User.find(params[:id])
@user.destroy

respond_to do |format|
format.html { redirect_to(users_url) }
format.xml { head :ok }
end
end

最佳答案

在带有 Assets 管道的 Rails 3.1 中,所有的 javascript 都在 application.js 中。因此,您需要“应用程序”而不是 :defaults。

<%= javascript_include_tag "application" %>

关于ruby-on-rails-3 - 导轨 3 :method=> :delete doesn't work in Internet Explorer,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3772450/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com