Daniel Gomez Firmat
Daniel Gomez Firmat

Reputation: 43

button_to to <a href ="">

This should be an easy one but I cannot clock it.... so what I'm trying to achive is to put this:

<div class="btn-group" role="group">
  <%= button_to 'Message', conversations_path(sender_id: current_user.id, recipient_id: @user.id), method: 'post', :class => "btn btn-default" %>
</div>

In the form of something like this:

<div class="btn-group" role="group">
  <a class ="btn btn-default" href="conversations_path(sender_id: current_user.id, recipient_id: @user.id)" role="button"> Message </a>
</div>

Any ideas?

Thank you!

Upvotes: 0

Views: 221

Answers (1)

Mat
Mat

Reputation: 2184

From my comment:

link_to 'Message', conversations_path(sender_id: current_user.id, recipient_id: @user.id), class: 'btn btn-default', role: 'button'

link_to because you are requesting a link, not a real button

Upvotes: 1

Related Questions