2011-04-03 11 views

cevap

9

DÜZENLEME:

link_to "Visit Other Site", "http://www.rubyonrails.org/", :confirm => "Are you sure?" 
# => <a href="http://www.rubyonrails.org/" data-confirm="Are you sure?"">Visit Other Site</a> 

Sen JQuery için this one gibi göze batmayan JavaScript sürücüsü olmalıdır:
<%= link_to "Do something", {:controller => "foo", :action => "bar"}, :confirm => "Are you sure you want to do that?" %>

+0

dilsiz soru ... ama bu kod gitmek js geliyor? – jpwynn

+0

Üzgünüm, cevabı düzenledim! –

5

bir :confirm seçenek yoktur. Kurulumu oldukça basit.

Ayrıntılar Rails API'da bulunmaktadır. Rails 3'teki UJS hakkında daha fazla ayrıntı için this tutorial'u takip edebilirsiniz.

+0

okumak için çok faydalı linkler, çok teşekkür ederim! – jpwynn

14
buraya geldiğini Benim gibi olanlar için

ama vardır Raylar 4/5 tarih: Biliyorum

link_to "Title", some_path, data: { confirm: "Are you sure?" } 

The documentation

İlgili konular