Assuming your controller sets @league to either a new (in the new action) or existing (in the edit action) instance of League. This should automatically generate the right url in the admin namespace to either post or put the form depending on wheter or not @league.new_record? is true.
The only difference between the index action and the create action is
whether you're doing a get (index) or post (create). You can always
make sure you are using the right method by adding a :method=>xxx to
the form_for.
The only difference between the index action and the create action is
whether you're doing a get (index) or post (create). You can always
make sure you are using the right method by adding a :method=>xxx to
the form_for.
Ya, I tried that, but the initial form was rendering with the method =
"post" already.
Could it be that your original example read:
<% form_for :league, :url => admin_leagues_url do |f| %>
instead of
<% form_for :league, :url => admin_league_url do |f| %>
(Notice the difference between "admin_leagues_url" (plural) and
"admin_league_url" (singular)).