stig Garet
stig Garet

Reputation: 564

How to pass data into a <a> tag like link_to rails

I'm trying to transform this ruby link_to method into a classic tag. And before i'd use to pass some value (idz) into the parse after the link tag.

Is it possible to do the same with tags. Is because I need this value (idz) to run my controller method

Before :

<%= link_to rem_admin_group_path(group, idz: admin.id), method: :patch, remote: true do %>
  <div class="btn btn-danger pull-right"style='margin-left: 10px;'>
    <i class="fa fa-close" aria-hidden="true" ></i>
  </div>
<% end %>

After (without the value idz):

<a href="groups/<%=group.id%>/rem_admin",  data-method="patch" data-remote="true">
  <div class="btn btn-danger pull-right"style='margin-left: 10px;'>
    <i class="fa fa-close" aria-hidden="true" ></i>
  </div>
</a>

Upvotes: 0

Views: 801

Answers (1)

JaMes
JaMes

Reputation: 607

You can try something like this

<a href="groups/<%=group.id%>/rem_admin?idz=<%=admin.id%>",  data-method="patch" data-remote="true">
  <div class="btn btn-danger pull-right"style='margin-left: 10px;'>
    <i class="fa fa-close" aria-hidden="true" ></i>
  </div>
</a>

Upvotes: 1

Related Questions