所以,我使用activescaffold並有下面的代碼:活動腳手架:如何在刪除操作上設置確認文本?
config.actions = [:create, :delete, :list]
config.delete.link.confirm "Are you sure you want to delete this tag?"
它根據我GOOGLE了應該做的刪除鏈接確認框顯示的自定義文本......但事實並非如此。它仍然使用一些默認的問題文本。我如何定製確認文本?
所以,我使用activescaffold並有下面的代碼:活動腳手架:如何在刪除操作上設置確認文本?
config.actions = [:create, :delete, :list]
config.delete.link.confirm "Are you sure you want to delete this tag?"
它根據我GOOGLE了應該做的刪除鏈接確認框顯示的自定義文本......但事實並非如此。它仍然使用一些默認的問題文本。我如何定製確認文本?
爲什麼不使用視圖層來解決這個問題?
<%= button_to "Delete Foo", { :action => "delete", :id => @foo.id },
:confirm => "For Real?!", :method => :delete %>
http://api.rubyonrails.org/classes/ActionView/Helpers/UrlHelper.html
否則檢查你的JavaScript錯誤日誌? (螢火蟲?) – edwardsharp
這對香草鐵欄杆來說都很不錯,但這是與活動腳手架 –
它應該工作!
我已經開始了一個git代表與activescaffold相關的修復程序共享代碼。
你可以看到我的控制器在這裏: https://github.com/whizcreed/activescaffold-answers-to-stackoverflow/blob/master/app/controllers/notes_controller.rb
這裏是正常工作的代碼:我使用的軌道2.3.10 和activescaffold分支
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
:https://github.com/activescaffold/active_scaffold/tree/rails-2.3
我希望這有幫助。
你缺少的=
應該是:
config.delete.link.confirm = "Are you sure you want to delete this tag?"
你做的link_to或button_to?以及什麼版本的rails,js lib等?你如何將這些方法鏈接在一起? – edwardsharp
活動腳手架生成鏈接 –
您的意思是Gem [ActiveScaffold](https://github.com/activescaffold/active_scaffold)?它只被作爲標籤提及... – mliebelt