Purpose
When you traverse between pages of website, you have a link to indicate the current page you are on. So dynamically finding which links is to be set active is done by the below article. Please read the article below for better understanding.

There are many primitive ways of doing it but this seems correct as its DRY and KIS.

Article Link
highlight-link-based-on-current-page-in-rails