所以,我使用activescaffold,并有以下代码:
config.actions = [:create, :delete, :list]
config.delete.link.confirm "Are you sure you want to delete this tag?"
,根据我已经谷歌应该使删除链接确认框显示自定义文本…但事实并非如此。它仍然使用一些默认的问题文本。如何自定义确认文本?
应该可以!
我已经启动了一个git代表来共享与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
您缺少=
应该是:
config.delete.link.confirm = "Are you sure you want to delete this tag?"
为什么不使用视图层来解决这个问题呢?
<%= button_to "Delete Foo", { :action => "delete", :id => @foo.id },
:confirm => "For Real?!", :method => :delete %>
http://api.rubyonrails.org/classes/ActionView/Helpers/UrlHelper.html