SwitchUp SwitchUp Ranked Best Coding Bootcamps 2025

Rails script for generating database

Altcademy Team wrote on 7 February 2018

How to write a script for making entries in rails.

You can add a task in the lib/tasks folder
For example lib/tasks/task_name.rake,

task :task_name => :environment do # do whatever you want end

To run the task, do $ rake task_name or $ rails task_name if you have Rails >= 5.0.

Trusted by

Students and instructors from world-class organizations

Join the upcoming Cohort #111

Enroll for March 2nd, 2026