From 4e999eaf86d12f8fe509d3fdeef819c6a983e66a Mon Sep 17 00:00:00 2001 From: Jorge Manrubia Date: Mon, 3 Nov 2025 15:04:06 +0100 Subject: [PATCH] Use existing ARTENANT env var for selecting the tenant Thanks Mike for the tip! --- lib/tasks/seed.rake | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/lib/tasks/seed.rake b/lib/tasks/seed.rake index 31fada3a6..4c7dd3937 100644 --- a/lib/tasks/seed.rake +++ b/lib/tasks/seed.rake @@ -1,13 +1,11 @@ namespace :seed do - desc "Seed customer data for a specific account (e.g., rails seed:customer 1234)" - task :customer, [:tenant_id] => :environment do |t, args| - raise "Please provide a tenant ID: rails seed:customer[1234]" unless args[:tenant_id] + desc "Seed customer data for a specific account (e.g: rails seed:customer ARTENANT=1234)" + task :customer, [:tenant_id] => "db:tenant" do |t, args| + raise "Please provide a tenant ID: rails seed:customer ARTENANT=1234" unless ApplicationRecord.current_tenant - tenant_id = args[:tenant_id].to_i - ApplicationRecord.current_tenant = tenant_id account = Account.sole Account::Seeder.new(account, User.active.first).seed! - puts "✓ Seeded account #{account.name} (tenant: #{tenant_id})" + puts "✓ Seeded account #{account.name} (tenant: #{account.id})" end end