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"

你的意见?

4

1 回答 1

2

尝试用这些替换您的路线:

match '/my_controller/some_action1' => "my_controller#some_action1", :via => :get
match '/my_controller/some_action2/:some_param1' => "my_controller#some_action2", :via => :get
于 2012-08-05T08:59:56.637 回答