“...I've been working since 2008 with Ruby / Ruby on Rails, love a bit of Elixir / Phoenix and learning Rust. I also poke through other people's code and make PRs for OpenSource Ruby projects that sometimes make it. Currently working for InPay...”

Rob Lacey
Senior Software Engineer, UK

Calling rake task within other rake tasks

and blocking non-test environments for safety…

namespace :db do
  desc 'Rebuild test database and load seeds'
  task rebuild: [:environment] do
    fail ArgumentError, 'Test Environment required' unless Rails.env.test?
    Rake::Task['db:drop'].invoke
    Rake::Task['db:create'].invoke
    Rake::Task['db:schema:load'].invoke
    Rake::Task['db:migrate'].invoke
    Rake::Task['db:seed'].invoke
  end
end
GPK of the Day TOMMY Tomb