Reputation: 13378
I try to generate this path tag based on the type in my view:
<%= nearby_#{@nearby_type}_shop_path %>
But the #
sign commented out the rest of the text. Any solution?
Thank you.
Upvotes: 1
Views: 31
Reputation: 51697
You'll want to use send
to actually execute the code.
<%= send("nearby_#{@nearby_type}_shop_path") %>
Upvotes: 3
Reputation: 49104
<%= "nearby_#{@nearby_type}_shop_path" %>
or
nearby_<%= @nearby_type %>_shop_path
Upvotes: -1