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 - Ruby / Rails

Date:January 26, 2017