简体   繁体   中英

How to add a method to link_to do ViewHelper in Rails

Thats the original Devise logout link which works: link_to("Logout", destroy_user_session_path, :method => :delete)

Because of the and the I had to switch to this kind of link. The problem now is the link try to find the user sign_out

Tried:

  <%= link_to (destroy_user_session_path, :method => :delete) do %>
      <i class="icon-off"></i> Logout</span>
  <% end %>

and

  <%= link_to (destroy_user_session_path, method => :delete) do %>
      <i class="icon-off"></i> Logout</span>
  <% end %>

and

  <%= link_to (destroy_user_session_path, :method = 'delete') do %>
      <i class="icon-off"></i> Logout</span>
  <% end %>

Any ideas or suggestions?

I would do,

<span>
  <i class="icon-off">
  </i> 
  <%= link_to("Logout",destroy_user_session_path, :method => :delete)%>
</span>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM