ActionDispatch::Routing::PolymorphicRoutes

module ActionDispatch::Routing::PolymorphicRoutes

Included modules:
ActionController::ModelNaming

Polymorphic URL helpers are methods for smart resolution to a named route call when given an Active Record model instance. They are to be used in combination with ActionController::Resources.

These methods are useful when you want to generate correct URL or path to a RESTful resource without having to know the exact type of the record in question.

Nested resources and/or namespaces are also supported, as illustrated in the example:

polymorphic_url([:admin, @article, @comment])

results in:

admin_article_comment_url(@article, @c