0

因此,我正在使用 activescaffold 并具有以下代码:

config.actions = [:create, :delete, :list]
config.delete.link.confirm "Are you sure you want to delete this tag?"

根据我用谷歌搜索的内容,应该使删除链接确认框显示该自定义文本……但事实并非如此。它仍然使用一些默认问题文本。如何自定义确认文本?

4

3 回答 3

1

它应该工作!

我已经启动了一个 git rep 来共享与 activescaffold 相关的修复代码。

你可以在这里看到我的控制器: https ://github.com/whizcreed/activescaffold-answers-to-stackoverflow/blob/master/app/controllers/notes_controller.rb

这是正常工作的代码:

class NotesController < ApplicationController
  active_scaffold :notes  do  |config|
    config.columns = [:title, :content]
    config.delete.link.confirm = "Shows that you can change the confirm text  for delete!"
  end
end

我正在使用 rails 2.3.10 和 activescaffold 分支:https ://github.com/activescaffold/active_scaffold/tree/rails-2.3

我希望这有帮助。

于 2011-11-15T21:12:35.163 回答
1

你错过了= 它应该是:

config.delete.link.confirm = "Are you sure you want to delete this tag?"
于 2012-12-17T16:39:39.657 回答
-1

为什么不使用视图层来解决这个问题?

<%= button_to "Delete Foo", { :action => "delete", :id => @foo.id },
      :confirm => "For Real?!", :method => :delete %>

http://api.rubyonrails.org/classes/ActionView/Helpers/UrlHelper.html

于 2011-11-15T06:52:19.847 回答