[Generators] Add support for generation of a db seed as well in the generate command

Recently while developing many times I found there should be support to generate rails seed for the model as well. It can be as simple as an empty file with some basic boilerplate.

Enter code here…

namespace :seed do
  desc 'Generate an empty seed file, Usage => rake seed:create seed_name'
  task create: :environment do
    argument = ARGV[1]
    argument = "_#{ARGV[1]}" if argument.present?
    seed_path = "db/seeds/#{Time.now.to_i}#{argument}_seed.rb"
    FileUtils.touch(seed_path)
    exit
  end
end

``

I did something like this for all our organization products because we needed seeds to run in specific order. Need your reviews on this, is it a good idea to have the generator in the rails itself?

Additional details are here → Medium Blog