0

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 Answer 1

1

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

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

Sign up to request clarification or add additional context in comments.

1 Comment

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!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.