Skip to content

Commit

Permalink
Merge pull request #47222 from rafaelsales/patch-1
Browse files Browse the repository at this point in the history
Make the purpose of db/seeds.rb clearer through a better description and sample code.
  • Loading branch information
zzak committed Feb 15, 2023
2 parents 218ec10 + 4e1e9c8 commit 0d72275
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions railties/lib/rails/generators/rails/app/templates/db/seeds.rb.tt
@@ -1,7 +1,9 @@
# This file should contain all the record creation needed to seed the database with its default values.
# This file should ensure the existence of records required to run the application in every environment (production,
# development, test). The code here should be idempotent so that it can be executed at any point in every environment.
# The data can then be loaded with the bin/rails db:seed command (or created alongside the database with db:setup).
#
# Examples:
# Example:
#
# movies = Movie.create([{ name: "Star Wars" }, { name: "Lord of the Rings" }])
# Character.create(name: "Luke", movie: movies.first)
# ["Action", "Comedy", "Drama", "Horror"].each do |genre_name|
# MovieGenre.find_or_create_by!(name: genre_name)
# end

0 comments on commit 0d72275

Please sign in to comment.