views:

460

answers:

1

Here is the route:

 map.resources :networks do |network|
    network.resources :channels, :name_prefix => nil
  end

Here is what I have in my for my form.

<% form_for ([@network, @channel]) do |f| %>
...
<% end %>

I get an undefined method error since form_for is trying to call "network_channel_path". This error occurs because I have the channels :name_prefix as nil. How can I avoid this problem without completely writing out form_form with all the needed parameters?

+1  A: 

instead of using :name_prefix => nil use :shallow => true

This will not display the networks/:network_id and not mess with your _paths

ErsatzRyan
Using this method will require me to rework some of my views, mainly all of my path calls, but I do like this solution. Thanks!
mikeycgto
you will still have access to params[:network_id] FYI
ErsatzRyan