Module: ConcernsOnRails::Models::Hashable
- Extended by:
- ActiveSupport::Concern
- Defined in:
- lib/concerns_on_rails/models/hashable.rb
Constant Summary collapse
- VALID_TYPES =
%i[hex uuid integer custom].freeze
Instance Method Summary collapse
-
#assign_hashable_value ⇒ Object
Assigns the generated value only when the field is blank, so callers can still pass an explicit value at create time.
Instance Method Details
#assign_hashable_value ⇒ Object
Assigns the generated value only when the field is blank, so callers can still pass an explicit value at create time.
72 73 74 75 76 77 |
# File 'lib/concerns_on_rails/models/hashable.rb', line 72 def assign_hashable_value field = self.class.hashable_field return if self[field].present? self[field] = self.class.generate_hashable_value end |