Image for post
Image for post
Photo by Andriyko Podilnyk on Unsplash

This article aims to help people who want to learn about the seed feature in Rails. After this article readers will be able to quickly populate their database with the predefined records.

In a standard Rails project, we have the seed file atdb/seed.rb.

This file is triggered by the rails db:seed command and runs in the Rails context. Which means all the model structure will be available within the file.

It is also triggered by the rails db:reset and rails db:setup commands.

As it is obvious from the name, the main purpose of this file is to seed the database.

This is a very useful feature especially when you are in the learning stage where you are resetting the database many times in a day. …

Kubilay Çağlayan

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store