Class: TenantLevelSecurity::SchemaDumper::Policy
- Inherits:
-
Object
- Object
- TenantLevelSecurity::SchemaDumper::Policy
- Defined in:
- lib/activerecord-tenant-level-security/schema_dumper.rb
Instance Method Summary collapse
-
#initialize(table_name:, partition_key:) ⇒ Policy
constructor
A new instance of Policy.
- #to_schema ⇒ Object
Constructor Details
#initialize(table_name:, partition_key:) ⇒ Policy
Returns a new instance of Policy.
51 52 53 54 |
# File 'lib/activerecord-tenant-level-security/schema_dumper.rb', line 51 def initialize(table_name:, partition_key:) @table_name = table_name @partition_key = partition_key end |
Instance Method Details
#to_schema ⇒ Object
56 57 58 59 60 61 62 |
# File 'lib/activerecord-tenant-level-security/schema_dumper.rb', line 56 def to_schema schema = %( create_policy "#{table_name}") if partition_key != TenantLevelSecurity::DEFAULT_PARTITION_KEY schema += %(, partition_key: "#{partition_key}") end schema end |