Sha256: 4b780a51d99cf050fa6eaa86d340b4fb883b50fe0b494abc35f7a3e54d81acfc

Contents?: true

Size: 1.38 KB

Versions: 1

Compression:

Stored size: 1.38 KB

Contents

 # frozen_string_literal: true

# Configure after the application is initialized
Rails.application.config.after_initialize do
  HasStates.configure do |config|
    # Configure your models and their state types below
    #
    # Example configuration:
    #
    config.configure_model User do |model|
      # KYC state type with its allowed statuses
      model.state_type :kyc do |type|
        type.statuses = [
          'pending',              # Initial state
          'documents_required',   # Waiting for user documents
          'under_review',        # Documents being reviewed
          'approved',            # KYC process completed successfully
          'rejected'             # KYC process failed
        ]
      end
    
      # Onboarding state type with different statuses
      model.state_type :onboarding do |type|
        type.statuses = [
          'pending',          # Just started
          'email_verified',   # Email verification complete
          'profile_complete', # User filled all required fields
          'completed'         # Onboarding finished
        ]
      end
    end
    #
    # config.configure_model Company do |model|
    #   model.state_type :verification do |type|
    #     type.statuses = [
    #       'pending',
    #       'documents_submitted',
    #       'under_review',
    #       'verified',
    #       'rejected'
    #     ]
    #   end
    # end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
stateful_models-0.0.3 spec/dummy/config/initializers/has_states.rb