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

Contact

604-309-8713
info@solidfoundationwebdev.com

Send Me A Message

I would love to get in touch and talk about your next project. Feel free to send a message and I will get back to you shortly.

Get Connected