Restful and routes

Hello,

i am using Restful since few days. i havve got problem since i try to
usre routes liltle more complicated

my 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_url (:id => t, :faq_id => t.faq_id ), :method => :delete %>
  • <% end %>

And when i test, i can see this error

ActionController::RoutingError in Votes#index

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

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

Thanks all

Apparently I’ve encountered the same problem. Let me guess you’re
calling vote_url from a view on the faq_categories level?

I’m not sure how it should work with three nested levels, but I assmue
that Rails has a bug here?!

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs