title: How to manage both nested and not nested resources
body: <p>I wonder what is a proper way to resolve the following problem.</p>
  
  <p>I have two models : </p>
  
  <pre><code>Publisher and Issue. Publisher has_many issues.
  </code></pre>
  
  <p>I want to manage issues both from Publishers list and from Issues list.</p>
  
  <p>For example :</p>
  
  <ul>
  <li><p>on publishers list user can click link "Issues" placed near each publisher. then he goes to Issues list but filtered only for proper publisher. He can click "create new issue" and goes to form for add new issue. On this form i don't need to show him a select list to choose publisher</p></li>
  <li><p>on Issues list user can click "create new issue" and go to form but this time he should choose publisher from select, which will be related to created issue.</p></li>
  </ul>
  
  <p>Simply speaking i need crud action for issue alone and for publisher issue.</p>
  
  <p>First I try to make a :</p>
  
  <pre><code>  resources :issues
  
    resources :publishers do
      resources :issues
    end
  </code></pre>
  
  <p>and in issue controller :</p>
  
  <pre><code>before_filter :find_issue
  
  def find_issue
   @publisher = Publisher.find(params[:publisher_id]) if params[:publisher_id]
   @issues = @publisher ? @publisher.issues : Issue
  end
  </code></pre>
  
  <p>but i have to make many if condition in my views and controller.</p>
  
  <p>For example if issue is created from publisher , on success i want to redirect to <code>publisher_issues_path</code> instead of <code>issue_path</code> a vice versa. Same problem with all link like "back to list" and similar. So code is in my opinion not very transparent.</p>
  
  <p>Now i wonder to use namespaces.</p>
  
  <pre><code>namespace :publishers,  do
    resources :issues
  end
  </code></pre>
  
  <p>and make </p>
  
  <pre><code># app/controllers/publishers/issues_controller.rb
  module Publishers
    class IssuesController &lt; ApplicationController
      # actions that expect a :publisher_id param
    end
  end
  
  # app/controllers/issues_controller.rb
  class IssuesController &lt; ApplicationController
    # your typical actions without any publisher handling
  end
  </code></pre>
  
  <p>and make separate view for both controller actions.</p>
  
  <p>Is there a better or cleaner way to resolve this kind of problem? I want to make my code dry as possible.
  Many thanks for reply. </p>