How To Access Rails Routing Helpers From Anywhere In Your App

Posted by Weston Ganger

Sometimes you may want some code in your model to have accesss to Rails routing helpers. You can access these methods anywhere in the application.


Rails.application.routes.url_helpers.posts_path

Rails.application.routes.url_helpers.post_path(post)

Its simple actually.


Related External Links:

Article Topic:Software Development - Rails

Date:January 26, 2017

Recommended Posts