Search code examples
htmlruby-on-railsjquery-mobilehreferb

how to use rails path in href for jquerymobile button


I am working in rails using jquery.mobile button.(/view/sessions/new.html.erb)

I have a hard code path which I tried to change to rails routes path. Here original hard code:

 <a href="/password_resets/new" data-role="button" data-icon="info" data-mini="true">Forgotten password?</a>

My button is OK as expected in 2 nd button enter image description here

The problem when replaced with rails path (from rake routes) is the link. It only work at the text "Forgotten password", not the button itself. Here that code:

<div class="actions" data-role="button" data-icon="info" data-mini="true"><%= link_to 'Forgotten password?', new_password_reset_path %></div>

How to use rails path inside href?


Solution

  • You can try:

    <%= link_to 'Forgotten password?', new_password_reset_path, data: {icon: 'info', mini: 'true', role: 'button'} %>