If I have two modals joined with a has many two relationship, lets say (teams and players) and they are joined through (lineups)
Is there a way to access the join model id (lineups_id) in the view after calling something like:
@teams.players.each_with_index |players, index| do
players.lineups_id
end
As far as I know there’s no way to do this. But it can be solved fairly easily by rearranging your code a bit.
The
.includes(:player)isn’t actually necessary but it will improve your performance by eager loading the players.