What to do when rails db: seed does not reflect in the database

I wrote about how to write seeds.rb that can be used when putting dummy data in the database using seed.

When writing data in seeds.rb

seeds.rb


User.create!(name: ...)

By adding! After create as described above, an error will be displayed when data registration fails in the database.

Recommended Posts

What to do when rails db: seed does not reflect in the database
What to do when Rails on Docker does not reflect controller changes in the browser
[Rails] What to do when the error No database selected and Unknown database appears in db: migrate
What to check when rails db: migration does not pass
What to do when the changes in the Servlet are not reflected
[Rails] What to do when rails s does not respond or does not stop
What to do when "relation" hibernate_sequence "does not exist" in the ID column of PostgreSQL + JPA
[Grails] Error occurred running What to do when the Grails CLI does not start
What to do when Method not found in f: ajax
What to do if the update does not take effect after deploying Rails AWS
What to do when ‘Could not find’ in any of the sources appears in the development environment with Docker × Rails × RSpec
What to do if the Rails page doesn't appear in Rails tutorial 1.3.2
What to do when a could not find driver appears when connecting to a DB in a Docker environment
[Rails Tutorial Chapter 2] What to do when you make a mistake in the column name
What to do if Cloud9 is full in the Rails tutorial
[Programming beginner] What to do when rails s becomes an error in the local development environment
[Note] What to do if bundle install in Chapter 3 of the rails tutorial is not possible
[Rails 5] [Turbolinks] What to do when JS does not work due to page transition or browser back
What to do if the app is not created with the latest Rails version installed when rails new
What to do when Blocked Host: "host name" appears in Ruby on Rails
What to do when debugging "Source not found"
[Rails] Added in devise: username not added to database
What to do when IllegalStateException occurs in PlayFramework
What to do if Operation not permitted is displayed when you execute a command in the terminal
What to do if the changes are not reflected in the jar manifest file
What to do when the value becomes null in the second getSubmittedValue () in JSF Validator
What to do when is invalid because it does not start with a'-'
What to do if ffi installation fails when launching an application in Rails
What to do if the Rails server can't start
What to do when The SSL certificate has expired
What to do when JSF tags do not become HTML
What to do when rails creates a 〇〇 2.rb file
When the server does not start with rails s
[Rails] What to do when the Refile image is not displayed when writing the processing at the time of Routing Error
[React.useRef] What to do when the latest state cannot be referenced in the event listener
Processing when an ID that does not exist in the database is entered in the URL
What to do when "Fail to load the JNI shared library" is displayed in Eclipse
What to do when Address already in use is displayed after executing rails s
What to do if the JSONHint annotation does not work with lombok and JSONIC
What to do if the breakpoint is shaded and does not stop during debugging
"Do not show again" check does not work in the warning dialog when starting applet
The story when the test folder was not created in Rails
What to do when you launch an application with rails
# What to do if you accidentally do rails db: migrate: drop
How to get the log when install4j does not start
[Rails] How to display information stored in the database in view
What to do if you can't use the rails command
[Rails] What to do if you accidentally install bundle in the production environment in your local environment
What to do if you installed Ruby with rbenv but the version does not change
How to solve the problem when the value is not sent when the form is disabled in rails and sent
Bluemix Infrastructure VPN does not connect because it does not support NPAPI! What to do when [Mac]
[Rails] What to do when the view collapses when a message is displayed with the errors method
What to do when an error occurs in rails db: migrate ((StandardError: An error has occurred, this and all later migrations canceled :))
[Rails] What to do when rails db: migrate cannot be done because there is no table referenced by the foreign key
What to do when an error (StandardError: An error has occurred, this and all later migrations canceled:) appears in rails db: migrate
What to do if you select a JRE in Eclipse and get "The selected JRE does not support the current compliance level 11"
What to do when javax.batch.operations.JobStartException occurs
[Ubuntu 20.04] What to do if the external monitor is not recognized
What to do when an UnsupportedCharsetException occurs in a lightweight JRE
If the DB container does not start with Initializing database files
What I did when the DB did not start with docker-compose up