RestFul & Nested Routes

Salut Salut,

J’utilise depuis quelque jours Restful donc je suis en train passer
aux routes ‘nested’

mes routes

ActionController::Routing::Routes.draw do |map|
map.resources :users, :roles, :sessions,:jetons

UJS::routes

map.resources :faq_categories do |t|
t.resources :faqs do |t|
t.resources :votes
t.resources :comments
end
end

map.connect ‘:controller/:action/:id’
map.index ‘’, :controller => “pages”, :action => “index”
end

votes/index

    <% @votes.each do |t| %>
  • <%= h(t.ip) %> * * <%= h(t.faq_id) %> / <%= h(t.score) %> <%= link_to image_tag ('trash.png'), vote_path (:faq_id => t.faq_id, :id => t ), :method => :delete %>
  • <% end %>

Alors quand je teste ma vue j’ai ce message

ActionController::RoutingError in Votes#index

Showing app/views/votes/index.rhtml where line #4 raised:

vote_url failed to generate from
{:controller=>“votes”, :faq_id=>“41”, :action=>“show”, :id=>“1”},
expected: {:controller=>“votes”, :action=>“show”}, diff:
{:faq_id=>“41”, :id=>“1”}

Extracted source (around line #4):

Merci tout le monde

J’ai touvé il fallait faire ainsi :smiley:

<%= link_to image_tag (‘trash.png’), vote_path (:faq_category_id =>
t.faq.faq_category_id,:faq_id => t.faq, :id => t ), :method
=> :delete %>

Le 17 oct. 06 à 12:38, Bolo M. a écrit :

UJS::routes
end

{:faq_id=>"41", :id=>"1"}

Extracted source (around line #4):

Merci tout le monde

Bolo M.
Responsable des Développements Internet
[email protected]