For example, I have constructed a string called \"new_work_path\", now I want to call that helper as a method.
I\'ve tried send(\"new_work_path\", vars)
and
My bad, as per @tadman suggested, I tried to use send(:new_work_path, args)
again and it worked! Must have mistyped it before.
Before finding out that send works right away, I had found another solution which is also of interest:
new_polymorphic_path(Work, args)
Which seems to offer some syntactic sugar as well.
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(...)