What objects should I pass to my link_to for a triple nested route? I want to retrieve the exercise show page.
show.html.erb - workouts
<%= link_to exercise.name, plan_workout_exercise_path(???) %>
routes.rb
resources :plans do
resources :workouts do
resources :exercises
end
end
workouts_controller.html.erb
def show
@workout = Workout.find(params[:id])
end
I have attempted the following, but it doesn't feed the right ID to the right model.
<%= link_to exercise.name, plan_workout_exercise_path(@plan, @workout, @exercise) %>