How to use polymorphic_path in lib/module in Rails 4 -


i want call polymorphic_path in helper module located @ lib/my_module.rb.

i tried following this answer, works in model, not in module:

module mymodule   include actiondispatch::routing::polymorphicroutes   include rails.application.routes.url_helpers    def link(model)     polymorphic_path(model)   end end 

i get:

undefined method `polymorphic_path' mymodule:module 

btw, load module through config.autoload_paths += %w(#{config.root}/lib) in config/application.rb.


Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

javascript - Get parameter of GET request -

javascript - Twitter Bootstrap - how to add some more margin between tooltip popup and element -