我需要從Rails的Ruby的方法進行系統調用,但我希望它保持在同一頁面上。 現在由於某種原因,它不執行,但顯示:來自方法的系統調用(ruby on rails)
Routing Error
No route matches [POST] "/devices/22918"
Try running rake routes for more information on available routes.
這是按鈕:
<%= link_to image_tag("/images/glossy_green_button.png"), device , :method => :turnon, :confirm => "Are you sure?" %>
這是方法:
def turnon
@device = Device.find(params[:id])
result = `/perl/toggle.pl @device.infodot on`
end
請讓我知道我我做錯了,
謝謝
D
如果你希望用戶停留在同一頁面上,你不應該使用AJAX? link_to向您的rails應用程序發送信號,指出您想要用戶訪問的新頁面。 – Josh