Split your database seeds.rb by Rails environment
18-Aug-2023 889
The seeds.rb file in a Ruby on Rails app can be a double-edged sword.On one hand, it's very useful! The seeds.rb file makes it easy to pre-populate your database with data for development or production. Unfortunately though, since each Ruby on Rails app only has a single seeds.rb file, it can quickly get cluttered. Plus, there's bound to be data you want to seed in production, but not development (or vice-versa).That's where this article comes in! This short guide will show you how split your seeds.rb file into 3 separate files, one for each Rails environment.This will help you organise your database seeds better, and let you seed data for development without cluttering your production app.
Split your database seeds.rb by Rails environment #ruby #rubydeveloper #rubyonrails #Split #database #seeds.rb #Rails #environment #database #environment https://rubyonrails.ba/link/split-your-database-seeds-rb-by-rails-environment