Sha256: 860609e7cfa977640d67f09fa5fade142d477977651051a738d567023cfe9a97
Contents?: true
Size: 493 Bytes
Versions: 1
Compression:
Stored size: 493 Bytes
Contents
# frozen_string_literal: true module ActiveUxid module Record module Hash extend ActiveSupport::Concern included do after_create :callback_generate_uxid!, if: proc { respond_to?(:uxid) } end def uxid_to_id return unless respond_to?(:uxid) ActiveUxid::Hash.decode(uxid) end private def callback_generate_uxid! hash = ActiveUxid::Hash.encode(id) update_column(:uxid, hash) end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
active_uxid-1.0.0 | lib/active_uxid/record/hash.rb |