Is there any way of interpolating into a call to a route helper?
I have a partial in which I pass a resource (User, Gallery etc) as a local called resource
. I need a link to edit the resource, but I need the link to be different for each resource:
For a user the link needs to use the helper edit_user_path
, for Gallery it needs to use edit_gallery_path
etc.
So I need a way to interpolate the resource name into the helper (Pseudo code):
edit_{resource.name}_path
You can replace edit_user_path
with send("edit_user_path")
. Already verified in console.
Now you can interpolate the string inside.
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