Home>

I'm sorry for the first question and the unfamiliar text.
I want to resize the image using the variant method.
If i use the variant method, it will not be resized and the image will not be displayed.

Corresponding source code

<% = image_tag tweet.image.variant (resize: '500x500') if tweet.image.attached?%>
        
      <span><% = image_tag'arrow_top.png'%></span>
      <ul>
        <li>
          <% = link_to'Details', tweet_path (tweet.id), method:: get%>
        </li>
        <% if user_signed_in?&&current_user.id == tweet.user_id%>
        <li>
          <% = link_to'edit', edit_tweet_path (tweet.id), method:: get%>
        </li>
        <li>
          <% = link_to'Delete', tweet_path (tweet.id), method :: delete%>
        </li>
        <% end%>
      </ul>
      
    <p><% = tweet.title%></p>
    <span>
      <% = tweet.text%>
    </span>
          <span>
        ">
        <span>Posted by</span><% = tweet.user.nickname%>
        
    </span>
  
What I tried

I searched google search for cases that are not displayed, but I could not find a case that corresponds to this time.

Supplementary information (FW/tool version, etc.)

I am using ruby ​​on rails.


In this way, the image disappears.
I would be grateful if anyone could give me some advice.
Thanks for your cooperation.

  • Answer # 1

    To tweet model

    has_one_attached: image


    Installation of minimagick
    Have you done that?

    This article may be helpful.
    https://qiita.com/kazuomatz/items/3cdbd2c40576c2e9d89b