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_controllerclass 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
Related articles
- i displayed the image in html, but the characters are blurry solution
- ruby - the image is not displayed in the product listing function
- ruby - i want to solve the problem that the image is not displayed when using the variant method
- ruby on rails - [rails] the initial image of the icon for the user is not displayed
- ruby - s3 image is not displayed (activestorage)
- ruby - bootstrap image is not displayed
- ruby - image is not reflected on heroku
- [unity] characters are not displayed even though it is hit
- ruby - when the search result of the model is displayed by the function to see more in kaminari, the whole is displayed instead
- ruby on rails - i want to post an image by dragging and dropping
- ruby - i want to display only the image of the logged-in user when executing the search function
- php - png image is not displayed
- [ruby + selenium] how to get the number of characters for each individual page
- ruby - [rails] i want to create an image link using the url of the image output using active storage
- i want you to solve the mysterious phenomenon that the ruby error message is not displayed why is it evoked in view by applying
- ruby - the poster's name is not displayed in showhtmlerb
- ruby - partial template is not displayed (rails)
- ruby - unable to get initial image when using s3 with active storage
- javascript - the entered characters are not displayed js
Related questions
- ruby - i don't feel that the sql issued by rails has a different format from the sql that i usually write
- html - i would like to know how to calculate the average of the data
- ruby - i want to solve the n + 1 problem when using rails where method in loop processing
- ruby - i want to get it at intervals by searching using rails active record
- ruby - [rails] duplicate column name: it is displayed as reset_sent_at, but i do not know the duplicated part
- [ruby/rails] when you want to replace in a specific character string
- ruby - how to implement the edit/update function of multiple tables when using form object in rails
- ruby - all rails gems are not installed
- ruby - output the total integer value held by each user
<% = user.image%>
I did something like that
<% = image_tag user.image%>
Should have done something