title: Rails 5 incorrect URL in link_to
body: <p>In my OrganizationsController in have this:</p>
  
  <pre><code>class OrganizationsController &lt; ApplicationController
  before_action :require_login
  
    def show
      @organization = current_user.organizations.find(params[:id])
    end
  
  end
  </code></pre>
  
  <p>And in show.html.erb</p>
  
  <pre><code>&lt;% @organization.repositories.each do |repository| %&gt;
    &lt;%= link_to repository.name, organization_repository_path(repository) %&gt;
  &lt;% end %&gt;
  </code></pre>
  
  <p>Params:</p>
  
  <pre><code>Parameters &lt;ActionController::Parameters {"controller"=&gt;"organizations", "action"=&gt;"show", "id"=&gt;"3"} permitted: false&gt;
  </code></pre>
  
  <p>routes:</p>
  
  <pre><code>URI pattern:
  organization_repository GET /organizations/:organization_id/repositories/:id(.:format)
  </code></pre>
  
  <p>Link_to generates this URL:</p>
  
  <pre><code>/organizations/126/repositories/3
  </code></pre>
  
  <p>Whereas the organization_id is 3 and repository_id is 126 so the URL should rather be:</p>
  
  <pre><code>/organizations/3/repositories/126
  </code></pre>
  
  <p>How to generate proper URL?</p>
  
  <pre><code>/organizations/3/repositories/126
  </code></pre>