How can I access polymorphic_path inside a model in Rails 4?
Try including also PolymorphicRoutes
:
include ActionDispatch::Routing::PolymorphicRoutes
include Rails.application.routes.url_helpers
def link
polymorphic_path(self)
end
Try including also PolymorphicRoutes
:
include ActionDispatch::Routing::PolymorphicRoutes
include Rails.application.routes.url_helpers
def link
polymorphic_path(self)
end