2010-07-18 81 views
2

這可能是因爲button_to_remote函數似乎被定義爲Prototype helper?我用jQuery驅動替換了我的/public/javascripts/rails.jsbutton_to_remote使用jQuery和Rails 3

當我嘗試使用button_to_remote我得到的錯誤undefined method 'button_to_remote' for #<#<Class:0x000001078d7090>:0x0000010789ad20>

如果使用button_to_remote,我怎麼能做到使用jQuery + Rails的3

回答

4

試試這個同樣的事情是不可能的:

<%= button_to "Do Something", 
       { :controller => :somecontroller, :action=> :something }, 
       { :remote => true } 
%> 
+0

謝謝。你如何指定響應動作的控制器? – 2010-10-24 14:36:35

+0

代碼段已更新... – Rob 2010-10-25 12:53:58

+0

我將此標記爲答案,但我沒有對其進行測試;) – 2012-01-05 21:06:19