I have a class method in application_controller.rb:
def self.method1
path = some_path
end
Now it seems I can't access some_path since usually I'll need to use route in a controller (instance method).
What is the best way to access routes here?
Thanks
This should work from anywhere in your application
path = Rails.application.routes.url_helpers.some_path
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With