Rails

How To Access Rails Routing Helpers From Anywhere In Your App

Posted by Weston Ganger on January 26, 2017

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:


Posted in Rails and Tagged with rails routing 


Need help on your next project or application?

I specialize in Ruby-on-Rails, AngularJS, Javascript, Bootstrap, and Hybrid Mobile Apps with Cordova & Ionic.

Contact Me

Recommended Posts