lib/lite/uxid/record/uuid.rb in lite-uxid-1.5.2 vs lib/lite/uxid/record/uuid.rb in lite-uxid-2.0.0

- old
+ new

@@ -1,24 +1,22 @@ # frozen_string_literal: true -require "active_support" unless defined?(ActiveSupport) - module Lite module Uxid module Record module Uuid - extend ActiveSupport::Concern - - included do - before_create :callback_generate_uxid!, - if: proc { respond_to?(:uxid) && !uxid? } + def self.included(base) + base.class_eval do + before_create :callback_generate_uxid!, + if: proc { respond_to?(:uxid) && !uxid? } + end end private def callback_generate_uxid! - self.uxid = Lite::Uxid::Uuid.encode + self.uxid = Lite::Uxid::Irreversible::Uuid.encode end end end end