Richard Hart

Head of Something @ Somewhere
Kent, UK

My Music
My Photos

LinkedIn
Mastodon

Accessing Spree routes from outside a controller

Some custom reports I was adding to Spree required links back to the products being listed. Accessing the Spree routes is slightly different to accessing normal Rails routes from outside a controller/view:

Spree::Core::Engine.routes.url_helpers.product_url(product, host: "http://www.yourdomain.com")