Class: RailsAuditLog::Generators::TenantGenerator
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- RailsAuditLog::Generators::TenantGenerator
- Includes:
- ActiveRecord::Generators::Migration
- Defined in:
- lib/generators/rails_audit_log/tenant/tenant_generator.rb
Instance Method Summary collapse
Instance Method Details
#create_migration_file ⇒ Object
13 14 15 16 17 18 |
# File 'lib/generators/rails_audit_log/tenant/tenant_generator.rb', line 13 def create_migration_file migration_template( "add_tenant_id_to_audit_log_entries.rb", "db/migrate/add_tenant_id_to_audit_log_entries.rb" ) end |
#print_next_steps ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/generators/rails_audit_log/tenant/tenant_generator.rb', line 20 def print_next_steps say "" say "Next steps:", :green say " 1. Run `bin/rails db:migrate` to add the tenant_id column." say " 2. Set a global resolver in your initializer:" say " RailsAuditLog.current_tenant { Current.tenant_id }" say " or per-model:" say " audit_log tenant: -> { Current.tenant_id }" say " 3. Use AuditLogEntry.for_tenant(id) to scope queries to a tenant." say "" end |