我的路線發佈值是:(i手動創建):的form_tag問題與我的應用程序的特定控制器的Rails
scope :path => '/labor', :controller => :labor do
get '/' => :index, :as => 'labor'
post 'start/:work_hours' => :start, :as => 'start'
post 'stop' => :stop, :as => 'stop'
end
我創建一個的form_tag,但我通過張貼有問題值。我的表格目前是:
<%= form_tag start_path do %>
<%= select_tag :work_hours, options_for_select([ "1", "2", "3", "4", "5", "6", "7", "8" ], "1") %>
<%= submit_tag "#{t 'labor.start_work'}" %>
<% end %>
我期望能夠工作,但不幸的是,它不,我不明白爲什麼。我實際上得到了一個路由錯誤沒有路由匹配{:controller =>「labour」,:action =>「start」}
爲什麼會發生這種情況,我該如何解決它,以便work_hours正確從表單發佈?
你有沒有在你的控制器中啓動'start'? – 2011-03-28 04:43:13
是的,所有的處理和東西。 rspec測試在該操作上也可以正常工作。 – Spyros 2011-03-28 04:50:46