You should crate a partial
_controls.html.erb
<%= link_to path do %>
<span class="glyphicon glyphicon-pencil"></span>
<% end %> |
<%= link_to model, method: :delete, confirm: "Are you sure?" do %>
<span class="glyphicon glyphicon-trash"></span>
<% end %>
Then you can call it as follows:
<%= render :partial => "controls", :locals => {:path => edit_topic_path(topic), :model => topic} %>