Module: Legion::Data::Model::Identity::ModelHelpers
- Included in:
- Legion::Data::Model::Identity, AuditLog, Group, GroupMembership, Identity, Principal, Provider, Legion::Data::Model::IdentityGroup, Legion::Data::Model::IdentityProvider, Principal
- Defined in:
- lib/legion/data/models/identity/model_helpers.rb
Defined Under Namespace
Modules: ClassMethods
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.included(model) ⇒ Object
10 11 12 |
# File 'lib/legion/data/models/identity/model_helpers.rb', line 10 def self.included(model) model.extend(ClassMethods) end |
.table_available?(table_name) ⇒ Boolean
14 15 16 17 18 |
# File 'lib/legion/data/models/identity/model_helpers.rb', line 14 def self.table_available?(table_name) Legion::Data::Connection.sequel&.table_exists?(table_name) rescue StandardError false end |
Instance Method Details
#before_create ⇒ Object
78 79 80 81 |
# File 'lib/legion/data/models/identity/model_helpers.rb', line 78 def before_create self[:uuid] ||= SecureRandom.uuid if self.class.columns.include?(:uuid) super end |