Possible Duplicate:
Rails: Routing without plurals gives strange helpers扶手:路由和路徑傭工
原來我有:資源qtl_table在配置/ routes.rb中兩次!我得到這個錯誤:
undefined local variable or method `search_qtl_table_index' for #<#<Class:0x805aff3e0>:0x805af47b0>
在app /視圖/ qtl_table/index.html.erb:
<h2>Search for QTL</h2>
<%= form_tag search_qtl_table_index, :method => 'get' do %>
<%= text_field_tag :search, params[:search] %>
<%= submit_tag "Search", :name => nil %>
<% end %>
和配置/ routes.rb中:
Qtl::Application.routes.draw do
resources :qtl_table do
collection do
get 'search'
end
end
...
end
是我做的已關閉複數:
ActiveRecord::Base.pluralize_table_names = false
耙路線輸出:
search_qtl_table_index GET /qtl_table/search(.:format) {:action=>"search", :controller=>"qtl_table"}
qtl_table_index GET /qtl_table(.:format) {:action=>"index", :controller=>"qtl_table"}
POST /qtl_table(.:format) {:action=>"create", :controller=>"qtl_table"}
new_qtl_table GET /qtl_table/new(.:format) {:action=>"new", :controller=>"qtl_table"}
edit_qtl_table GET /qtl_table/:id/edit(.:format) {:action=>"edit", :controller=>"qtl_table"}
qtl_table GET /qtl_table/:id(.:format) {:action=>"show", :controller=>"qtl_table"}
PUT /qtl_table/:id(.:format) {:action=>"update", :controller=>"qtl_table"}
DELETE /qtl_table/:id(.:format) {:action=>"destroy", :controller=>"qtl_table"}
步驟#1:與該定義的路由有關的'rake routes'的輸出是什麼? – tadman 2012-01-04 15:14:57
請不要轉發您的問題。 – NullUserException 2012-01-06 02:42:06