2
Rails 3.2.2
此代碼拋出一個異常ArgumentError missing :action
,甚至當我去的網頁/my_controller/some_action1
無法正確的參數傳遞到行動回報率
#routes
namespace :my_controller do
get 'some_action1'
get 'some_action2/:some_param1'
end
#Controller
class MyController < ApplicationController
def some_action1
end
def some_action2
#handling the ajax request
respond_to do |format|
format.js
end
end
end
#View /my_controller/some_action1.html.haml
link_to "my_link", {:controller => :my_controller, :action => :some_action2,
:some_param1=>123}, :remote=>true, :id=>"unique_id123"
您的想法?
那不是你應該如何使用[命名空間](http://guides.rubyonrails.org/routing.html#controller-namespaces-and-routing) 。埃雷茲的答案似乎是要走的路。 – Mischa 2012-08-05 09:05:11