rails generate 脚手架控制器 sportler name:string
rails generate model einheit ... sportler_id:integer
/app/controllers/sportlers_controller.rb
..
def add_einheit
sportler = Sportler.find(params[:id])
@einheit = Einheit.new(:sportler => sportler)
渲染 :template => "einheits/edit"
end
..
/app/views/sportles/index.html.erb - 当我将此源代码剪切到路由错误下方时,
不再出现
..
<td><br>
<%= link_to "Trainingseinheit hinzufügen", :action => "add_einheit", :id => sportler %><br>
</td><br>
..
路线.rb
FITAPP2::Application.routes.draw 做
资源 :sportlers
路由错误
没有路线匹配 {:action=>"add_einheit", :id=>#groesse: "3", created_at: "2012-12-27 15:56:04", updated_at: "2012-12-27 15:56: 04">,
:controller=>"sportlers"}
尝试运行 rake 路线以获取有关可用路线的更多信息。