LoginSignup
0
1

More than 3 years have passed since last update.

emptyの表記方法

Posted at

どこで調べたかは忘れたけど
empty?にはこういう表記方法もあるようだ

<% if @items.empty?.! %>
      <% @items.each do |item| %>
      <li class='list'>
        <%= link_to item_path(item.id) do %>
        <div class='item-img-content'>
          <%= image_tag item.image, class: "item-img" %>

emptyは文字列が空の時、真を返すが
emptyの後ろに.!をつけると反対の意味になるようだ

0
1
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1