我不知道,因爲除了我的應用程序之外,除了我的應用程序正在出錯之前工作的地方,錯誤在路由中。命名空間路由錯誤
ActionController::RoutingError (No route matches {:action=>"show", :controller=>"products", :id=>#<Product id: 10, title: "", code: "", description: "", price: nil, created_at: "2013-06-01 18:52:16", updated_at: "2013-06-01 18:52:16", permalink: nil, image_1_file_name: nil, image_1_content_type: nil, image_1_file_size: nil, image_1_updated_at: nil, image_2_file_name: nil, image_2_content_type: nil, image_2_file_size: nil, image_2_updated_at: nil, image_3_file_name: nil, image_3_content_type: nil, image_3_file_size: nil, image_3_updated_at: nil, image_4_file_name: nil, image_4_content_type: nil, image_4_file_size: nil, image_4_updated_at: nil, image_5_file_name: nil, image_5_content_type: nil, image_5_file_size: nil, image_5_updated_at: nil, image_6_file_name: nil, image_6_content_type: nil, image_6_file_size: nil, image_6_updated_at: nil, image_7_file_name: nil, image_7_content_type: nil, image_7_file_size: nil, image_7_updated_at: nil, image_8_file_name: nil, image_8_content_type: nil, image_8_file_size: nil, image_8_updated_at: nil, weight: nil, width: nil, height: nil, length: nil>}):
app/views/admin/products/index.html.erb:23:in `_app_views_admin_products_index_html_erb__949052465_2267215500'
app/views/admin/products/index.html.erb:12:in `each'
app/views/admin/products/index.html.erb:12:in `_app_views_admin_products_index_html_erb__949052465_2267215500'
是interessant,因爲在我看來,不具有錨顯示,該觀點是這樣的:
<h4>Produtos</h4>
<%= link_to 'Criar produto',new_admin_product_path %>
<table class="table table-striped">
<tr>
<td></td>
<td>Nome do Produto</td>
<td>Categorias</td>
<td>Preço</td>
<td></td>
<td></td>
</tr>
<% @products.each do |p| %>
<tr>
<td><%= image_tag p.image_1.url(:thumb),:height => 30 %></td>
<td><%= p.title %></td>
<td>
<% p.categories.each do |a| %>
<%= a.name %>
<% end %>
</td>
<td><%= to_currency p.price %></td>
<td><%= link_to "Editar",edit_admin_product_path(p.id) %>
<%= link_to "Excluir",p,:method => :delete %></td>
</tr>
<% end %>
<table>
在我的路線是這樣的:
namespace :admin do
get '', :to => 'dashboard#index', :as => '/'
resources :products do
member do
delete :del_p_cat
end
end
resources :categories,:except => [:show]
resources :users
end
我嘗試提出:除了= > [:show]但是同樣的錯誤,如果沒有任何東西叫做動作表演,沒有意義。
在我的航線有演出時,我執行rake routes
:
admin_product GET /admin/products/:id(.:format) admin/products#show
和whitout命名空間管理:
product GET /products/:id(.:format) products#show
這個錯誤是如此的主要,我不會因爲一個痘痘時工作undertood,當我安裝我的嵌套窗體不工作更多,我不知道,因爲什麼路線我沒有改變。
不改變錯誤=/ – overallduka