Module: ManageRlsMigrationConcern
- Extended by:
- ActiveSupport::Concern
- Included in:
- RbacRls::GroupPermission, RbacRls::Permission
- Defined in:
- app/models/concerns/manage_rls_migration_concern.rb
Instance Method Summary collapse
- #delete_file(path) ⇒ Object
- #delete_nested_policy ⇒ Object
- #down_migrate(file_version = migration_version) ⇒ Object
- #get_migration_file_path(file_name = migration_version) ⇒ Object
Instance Method Details
#delete_file(path) ⇒ Object
24 25 26 27 28 29 30 31 |
# File 'app/models/concerns/manage_rls_migration_concern.rb', line 24 def delete_file(path) deleted = false if File.exist?(path) File.delete(path) deleted = !File.exist?(path) end deleted end |
#delete_nested_policy ⇒ Object
8 9 10 11 |
# File 'app/models/concerns/manage_rls_migration_concern.rb', line 8 def delete_nested_policy down_migrate() delete_file(get_migration_file_path) end |
#down_migrate(file_version = migration_version) ⇒ Object
13 14 15 16 |
# File 'app/models/concerns/manage_rls_migration_concern.rb', line 13 def down_migrate(file_version = migration_version) return true if system(RbacRls::Settings.down_migrate_command(file_version)) false end |
#get_migration_file_path(file_name = migration_version) ⇒ Object
18 19 20 21 22 |
# File 'app/models/concerns/manage_rls_migration_concern.rb', line 18 def get_migration_file_path(file_name = migration_version) path = Rails.root.join('db', 'migrate', "#{file_name}*").to_s file_path = Dir[path]&.first file_path.to_s end |