如何添加方法link_to在Rails中执行ViewHelper

时间:2013-08-27 18:02:35

标签: ruby-on-rails devise ruby-on-rails-4

这是原始的Devise注销链接,它起作用: link_to("Logout", destroy_user_session_path, :method => :delete)

因为和我不得不切换到这种链接。现在的问题是链接尝试找到用户sign_out

尝试:

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

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

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

有任何想法或建议吗?

1 个答案:

答案 0 :(得分:0)

我愿意,

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