Topic: Routing Error

Good Day,

I have created a scaffold sportler and one model einheit and this:

-app/views/sportlers/index.html.erb

...
    <td>
      <%= link_to "Trainingseinheit hinzufügen", :action => "add_einheit", :id => sportler %>
    </td>


-app/controllers/sportler_controller

  def add_einheit
    sportler = Sportler.find(params[:id])
    @einheit = Einheit.new(:sportler => sportler)
    render :template => "einheits/edit"
  end

-------------------------------------------------------------------------------------------------
Error-Code

Routing Error

No route matches {:action=>"add_einheit", :id=>#<Sportler id: 1, name: "Test", alter: 17, groesse: "188", created_at: "2012-12-27 12:51:22", updated_at: "2012-12-27 12:51:22">, :controller=>"sportlers"}
Try running rake routes for more information on available routes.

How can i resolve the routing problem?

ahha

routes

FITAPP2::Application.routes.draw do
  resources :sportlers

Last edited by ubuseral (2012-12-27 09:21:16)

Re: Routing Error

The best way to analyze routing error is to - run rake routes and analyze the path available with the one you're trying to use.