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