fix: Account seeder error on staging (#5371)

- Fix for Account seeding error on staging environments
This commit is contained in:
Sojan Jose
2022-09-01 21:23:57 +05:30
committed by GitHub
parent 4a74ab59d2
commit 7f3f6f7129
7 changed files with 17 additions and 10 deletions

View File

@@ -43,7 +43,7 @@ class SuperAdmin::AccountsController < SuperAdmin::ApplicationController
# for more information
def seed
Seeders::AccountSeeder.new(account: requested_resource).perform!
Internal::SeedAccountJob.perform_later(requested_resource)
redirect_back(fallback_location: [namespace, requested_resource], notice: 'Account seeding triggered')
end
end

View File

@@ -0,0 +1,7 @@
class Internal::SeedAccountJob < ApplicationJob
queue_as :low
def perform(account)
Seeders::AccountSeeder.new(account: account).perform!
end
end

View File

@@ -1,4 +1,4 @@
<% if !Rails.env.production? || ENV.fetch('ENABLE_ACCOUNT_SEEDING', nil) %>
<% if ENV.fetch('ENABLE_ACCOUNT_SEEDING', !Rails.env.production?) %>
<section class="main-content__body">
<hr/>
<%= form_for([:seed, namespace, page.resource], method: :post, html: { class: "form" }) do |f| %>