While using Spree, a Rails ecommerce engine, I was trying to save the products_path in my Spree::Product model for tracking.
Looking on SO I found this solution, which looked like the perfect answer.
Rails.application.routes.url_helpers.products_path
Rails.application.routes.url_helpers.products_url(:host => "example.com")
But using that solution just gave me the following error.
NoMethodError: undefined method `products_path' for #<Module:0x007fe9e208e908>
Much frustration....