Nested routes vs hidden_field

Hi all,

I’m having a problem wrangling nested routes and I’m not entirely sure how to use them in this particular scenario. The relationship I’m describing is that every User attaches a Proof to each PCI Requirement. I have a feeling that nesting Proof inside Requirement is the proper way to go. However, by going that route, we have to implement a hidden_field for user_id. But I feel using a hidden_field is wrong also. Then I thought, ok, what about nesting all the routes to do something like form_for [@user, @proof, @requirement] but Rails guides says that’s a no no.

I’m not entirely sure of the best pattern to use for this. I’d really appreciate some advice!

Here’s the PR where I’m having issues wrangling this

I finally figured out why things were going wrong. Its important to understand the usage of requirements#index.

I was going down the wrong path until this sent me in the right direction.

This pattern is actually in the Learn repo as purchasables_controller.rb in the create action with current_user