Creating A Seed File In Rails

Steven Klavins
2 min readMar 7, 2021

The purpose of creating a seed file in short is to populate sample data in your rails database. Having prepopulated data helps us test our application and better understand how it will look in production.

When creating a Rails application a seed file is created within the db directory and it’s named seeds.rb. By default, this file will have no code in it however Rails helpfully provides some clarification of its purpose.

# This file should contain all the record creation needed to seed the database with its default values.

--

--

Steven Klavins

Hi, I’m Steven, most call me Steve! I’m a programmer, musician, and artist. This blog contains various tutorials and posts related to software development.