How to dynamically call routes helper in rails?

try Rails.application.routes.url_helpers.send(...)

Edit:

As Larry Gebhardt mentioned the url_helpers module is no longer being cached.

Another workaround would be:

cached_helpers = Class.new do
  include Rails.application.routes.url_helpers
  include Rails.application.routes.mounted_helpers
end.new

cached_helpers.send(...)

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)