Mark Webster


50 Experience
0 Lessons Completed
0 Questions Solved


Posted in How do I pass an id to a foreign controller?

A very basic question I know, but I'm really struggling. If I use a link_to with the current controller's path then I get the id as a parameter but if I instead use a path to a different controller then I get a format instead.

So from the same view I get the following paths generated by the team show view:

team/2/add/ and player/add.2



logo Created with Sketch.

Ruby on Rails tutorials, guides, and screencasts for web developers learning Ruby, Rails, Javascript, Turbolinks, Stimulus.js, Vue.js, and more. Icons by Icons8

© 2021 GoRails, LLC. All rights reserved.