私はモデルを持っていますfoo。
私のconfig/routes.rb中で私は持っています:
resources :foo do
member do
post 'approve'
post 'delete'
end
get 'another_action'
end
jQuery$.get("/foo/another_action")呼び出しを実行すると、次の出力が得られます。
ActiveRecord::RecordNotFound (Couldn't find Foo with id=another_action):
app/controllers/foo_controller.rb:20:in `show'
私もやってみました:
resources :foo do
member do
post 'approve'
post 'delete'
end
end
resource :foo do
get 'another_action'
end
/foo/another_actionコントローラーがルートを ではなくリソースレベルのエンドポイントとして扱うようにルートを指定するにはどうすればよいidですか?