[RUBY] When I tried to reproduce Progate's Rails app on my PC (local environment), I got stuck at the image display

Overview When I tried to reproduce Progate's Rails app on my PC (local environment), I got stuck at the image display.

Development environment

macOS catalina version 10.15.6

Rails 6.0.3.2

Local development environment

Error message

undefined method `image_name' for nil:NilClass

Solution

It seems that an error has occurred because there is a post that was posted so far (post before adding the image_name column) → I should have erased everything

__ How to delete previous posts __

rails console

Post.destroy_all

This completes the deletion!

After deleting the record that caused the error (the record that does not have a column called image_name), the image was displayed safely.

Impressions

Can I reproduce Progate's Rails course app (Tweet app) on my PC (local environment)? With that feeling, when I was copying sutras while looking at Progate as a review so far, I was confused with an error message even though it should have been reproduced in exactly the same way.

It's a lot of learning because it gives you errors that you couldn't get with Progate.

(Later talk) Actually completed app

I wrote the following article about the actually completed application.

https://qiita.com/tamapora/items/abab44dd099603d87f3e

Helpful page

https://teratail.com/questions/231403

Recommended Posts

When I tried to reproduce Progate's Rails app on my PC (local environment), I got stuck at the image display
I tried to introduce Bootstrap 4 to the Rails 6 app [for beginners]
I want to put the JDK on my Mac PC
I tried to implement the image preview function with Rails / jQuery
After learning Progate, I tried to make an SNS application using Rails in the local environment
[Rails] I can post S3 images in my local environment, but I can't switch to S3 on Heroku.
I tried to display the calendar on the Eclipse console using Java.
When I tried to build an environment of PHP7.4 + Apache + MySQL with Docker, I got stuck [Windows & Mac]
How to solve the local environment construction of Ruby on Rails (MAC)!
I tried migrating the portfolio created on Vagrant to the Docker development environment
I tried to introduce CircleCI 2.0 to Rails app
[First environment construction] I tried to create a Rails 6 + MySQL 8.0 + Docker environment on Windows 10.
I want to play a GIF image on the Andorid app (Java, Kotlin)
[Rails] I tried to raise the Rails version from 5.0 to 5.2
I tried to organize the session in Rails
[Ruby On Rails / HTML] How to display the cursor (caret) at an appropriate place when displaying a web page
The story that did not disappear when I tried to delete mysql on ubuntu
[Rails] How to display an image in the view
I installed Squid on CentOS in my local environment
[Ruby on Rails] I want to get the URL of the image saved in Active Storage
[Rails 6.0, Docker] I tried to summarize the Docker environment construction and commands necessary to create a portfolio
When I set webpack.config.js to run vue.js on rails6, I got too many errors and grass
I tried to develop the cache function of Application Container Cloud Service in the local environment
[Rails] I tried to create a mini app with FullCalendar
(Ruby on Rails6) Display of the database that got the id of the database
I tried to create React.js × TypeScript × Material-UI on docker environment
I tried to build the environment little by little using docker
I tried to build the environment of WSL2 + Docker + VSCode
[Programming beginner] What to do when rails s becomes an error in the local development environment
I tried to take a look at the flow of Android development environment construction with Android Studio
When I tried to run my own service, it failed, so I screwed it into the task scheduler