I am trying to build the functionality for comparing two different entities into my web app. The way I envisioned the process was:
- Link to the
- Search for a runner, which will show up on the
- Select the first entity. (Originally my goal was to have both searches taken care of with the
:indexroute of my
CompareController) This routes to a
:first_runnerroute indicating, where the second search is done.
- Search at
/compare/:idand on the same page have the search results show up
- Select a result and route to
The problem I’m having is (i) I couldn’t get all of this to work on one page so I moved away from that. Now I have three (going on four) pages. One for the first seach, second for after selecting the first search, and the show page, although I can’t get the search results to show on the second page so I’m working on building a fourth page in before the final
/show page. I thought there has to be a better way of handling this.
Is there a way to forward on the
params from a controller to the next one? This way I could forward on the first runner to the rendering of the second runner, and finally pass the conglomerate of those two onto my
show route. Otherwise, is there a way to pass on a
params and a database id to a controller?
My code is located here: https://github.com/spkane31/cc-rankings/blob/phoenix-front-end/rankings/lib/rankings_web/controllers/compare_controller.ex for the controller and I am working within compare contexts.
Thank you for your help!