Reputation: 48490
I am getting an undefined method 'players_path
when trying to bring up a form for a new player in a Ruby on Rails application. The problem is, I have my player route nested in a declaration like the following:
namespace :manage do
get "/" => 'management#index'
scope :nfl do
resources :players
end
end
That means a new player resource in this context would have a path of new_manage_player
, but my form declaration has the following:
<%= form_for @player, :html => { :class => 'form-horizontal' } do |f| %>
Is there a way to modify this form declaration so that the app doesn't break with players_path is not defined? I don't have players_path explicitly defined anywhere else, so I'm assuming form_for @player is what's causing it here.
Upvotes: 0
Views: 102
Reputation: 26528
You need to mention your namespace and scope in the decleration.
<%= form_for [:manage, @player], :html => { :class => 'form-horizontal' } do |f| %>
Upvotes: 1