Home>

The image is displayed as strange characters in rails


this

#


That is the place where the image is strange

I want to display this firmly as an image

Corresponding source code users/show_follow.html.erb
  <section>  <% = @ user.image if @ user.image.attached?%>   <% = @ user.nickname%>   <span><% = link_to "view my profile", @user%></span>  <span><b>Number of posts:</b><% = @ user.drinks.count%></span></section><section>  <% = render'shared/stats'%>  <% if @ users.any?%>              <% @ users.each do | user |%>        <% = user.image if user.image.attached?%>      <% end%>          <% end%></section></aside>  <% if @ users.any?%>  <ul>    <% = render @users%>  </ul><% end%>


of

<% = @ user.image if @ user.image.attached?%>

The part will be displayed in characters

users_controller
class UsersController</pre>
<strong>users/show.html.erb</strong>
<pre><code data-language = "Ruby"><% if current_user? (@user)%>   <% = current_user.nickname%>  <% = image_tag @ user.image.variant (resize: '100x100'), class:'user-img' if @ user.image.attached?%> <% = link_to "Edit profile", edit_user_path (@user)%>  <% end%><% unless current_user? (@User)%><% if current_user.following? (@User)%><% = render'unfollow'%><% else%><% = render'follow'%><% end%><% end%><% @user || = current_user%>"><strong>  <% = @ user.following.count%></strong>  following
    "><strong>  <% = @ user.followers.count%></strong>  followers
What I tried

rails image #
Even if you look it up
"How to use active storage"
I couldn't find an article that solved the same error

  48: def following
    49: # View followers
    50:
    51: @user = User.find (params [: id])
    52: @users = @ user.following
 =>53: binding.pry
    54: render'show_follow'
    55: end
[1] pry (#)>@user
=>#[2] pry (#)>@ user.image
=>#
  • Answer # 1

    <% = user.image%>
    I did something like that
    <% = image_tag user.image%>
    Should have done something