Rails not finding controller action -
so, have following link-to:
<%= link_to(outing_add_guests_path, :class => 'modal') %> <div id="notimportant"></div> <% end %>
when click on it, rails tells me that
no route matches {:controller=>"outings", :action=>"add_guests"}
however, here's routes file:
resources :outings "/add_guests" => "outings#add_guests" post "/add_guests" => "outings#add_guests" delete "/remove_guests" => "outings#remove_guests" end
and corresponding action outings controller:
def add_guests @outing_guest = outingguest.new(:outing_id => params[:outing_id]) @outing_guest.user_id = params[:user_id] if @outing_guest.save flash[:notice] = "guest added successfully" redirect_to({ :action => 'outing', :id => params[:outing_id] }) else flash[:notice] = "guest not added" redirect_to({ :action => 'outing', :id => params[:outing_id] }) end end
is there reason rails unable detect controller or actions?
edit: here's part of results rake routes
outing_add_guests /outings/:outing_id/add_guests(.:format) outings#add_guests post /outings/:outing_id/add_guests(.:format) outings#add_guests
i notice link_to
not consistent other routes
outing_add_guests_path outings_add_guests_path
did rake routes
verify outing_add_guests_path
exists?
edit:
your rake routes
shows need outing_id
routes aren't setup right (at least not post). i'd fix them way @ryanbigg suggesting.
Comments
Post a Comment