Polymorphic Path Helpers
Underlying many of the path helpers that we use day to day when building out the views in our Rails apps are a set of methods in the ActionDispatch::Routing::PolymorphicRoutes
module.
The #polymorphic_path
method given an instance of a model will produce the relevant show path.
Given just the model's constant, it will produce the index path.
Additionally, there are variants with edit_
and new_
prefixed for generating the edit and new paths respectively.
Last updated