我有這樣的路線:的ActionController :: RoutingError - 無路由匹配
耙路線:
channel_import GET /channels/:channel_id/import(.:format) channels#import
但是當我嘗試在的link_to使用它:
<%= link_to "Import", channel_import_path(:hit_id => index), :method=>:get %>
我得到此錯誤:
ActionController::RoutingError (No route matches {:action=>"import", :controller=>"channels", :hit_id=>0}):
這是我在routes.rb中添加路徑:
resources :channels do
get 'import' => 'channels#import'
end
這是我的控制器:
class ChannelsController < ApplicationController
def import
puts "import action"
head :ok
end
...
end
此操作是否應在特定通道的上下文中? –