I think adding parameters to Rake task is usually necessary. What is rake? It’s a ruby utility that you can use to build up a list of tasks, for your project, in a dynamic way. In order to create a rake task, you can just run
rails g task your_tasks_domain your_first_task your_second_task
Or, you can, create in a manual way, by adding a .rake
file in lib/tasks
folder
# lib/tasks/your_task_domain.rake namespace :your_tasks_domain do desc "TODO" task your_first_task: :environment do # You will write your code here # For example: Task.create(name: "my first task") end desc "TODO" task your_second_task: :environment do end end