0
我試圖創建一個表單提交給當前控制器(results_controller)內的某個動作。表單提交Unkown Action?
我的表單代碼:
<%= form_tag(:controller => "results", :action => "filter", :id => "filter") do %>
而在results_controlle.rb我有:
def filter
#setting dispatches
@dispatches = Dispatch.find_by_message_ids(params[:message_ids]) unless params[:message_ids].blank?
unless @dispatches.blank? || @input_messages.blank?
@output_messages = OutputMessage.find_by_dispatch_ids(
@dispatches.collect{|d| d.id }.uniq
)
end
respond_to do |format|
format.html #default rendering
end
end
但我得到的錯誤:
Unknown action
The action 'filter' could not be found for ResultsController
有什麼建議?
UPDATE 在同一頁上,我有做工作的一種形式:
<%= form_tag(:controller => "results", :action => "show", :id => "show") do %>
請發佈你的config/routes.rb文件。 – Gazler
@Gazler當我運行'耙路線'我得到︰'/results/show(.:format){:controller =>「results」,:action =>「show」}'和 'results_filter/results/filter (。:format){:controller =>「results」,:action =>「filter」}' –