简体   繁体   English

Rails设计用户是否未登录

[英]Rails Devise check if User has not Logged in

I am trying to check if the user session is not active 我试图检查用户会话是否未激活

<% if user_signed_in?! %>
        <div class="homeActions">
          <%= link_to "Become a Host", new_host_path, class: "btn btn-lg btn-success" %>
        </div>
        <% end %>

You can use 您可以使用

<% if !user_signed_in? %>

or 要么

<% if not user_signed_in? %>

or 要么

<% unless user_signed_in? %>

! and not negate the preceding boolean expression, while unless is the exact opposite of if . not否定前面的布尔表达式,而unlessif完全相反。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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