I’m writing my own ruby gem and I have to use the url_for ActionView method. I just want to know how I can use that method in my gem with the defined routes in my rails app to generate the url paths by sending controller, action (and etc) params to the method.
Share
A simple approach is to pass the view object from the app into your gem methods when needed.
For example a template your app might say:
And the gem could implement the method like: