diff --git a/Gemfile.lock b/Gemfile.lock index e80fd57..50196c9 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,29 +1,28 @@ PATH remote: . specs: - uuidable (0.2.4) + uuidable (0.2.5) activerecord (>= 4.2, < 6.1) uuidtools (>= 2.1, < 3) GEM remote: https://rubygems.org/ specs: - activemodel (5.2.4.4) - activesupport (= 5.2.4.4) - activerecord (5.2.4.4) - activemodel (= 5.2.4.4) - activesupport (= 5.2.4.4) - arel (>= 9.0) - activesupport (5.2.4.4) + activemodel (6.0.3.5) + activesupport (= 6.0.3.5) + activerecord (6.0.3.5) + activemodel (= 6.0.3.5) + activesupport (= 6.0.3.5) + activesupport (6.0.3.5) concurrent-ruby (~> 1.0, >= 1.0.2) i18n (>= 0.7, < 2) minitest (~> 5.1) tzinfo (~> 1.1) + zeitwerk (~> 2.2, >= 2.2.2) addressable (2.4.0) - arel (9.0.0) ast (2.3.0) backports (3.6.8) - concurrent-ruby (1.1.7) + concurrent-ruby (1.1.8) diff-lcs (1.2.5) ethon (0.8.1) ffi (>= 1.3.0) @@ -40,12 +39,12 @@ GEM net-http-persistent (>= 2.7) net-http-pipeline highline (1.7.8) - i18n (1.8.5) + i18n (1.8.9) concurrent-ruby (~> 1.0) json (2.3.1) launchy (2.4.3) addressable (~> 2.3) - minitest (5.14.2) + minitest (5.14.3) multi_json (1.11.2) multipart-post (2.0.0) net-http-persistent (2.9.4) @@ -93,11 +92,12 @@ GEM typhoeus (~> 0.6, >= 0.6.8) typhoeus (0.8.0) ethon (>= 0.8.0) - tzinfo (1.2.7) + tzinfo (1.2.9) thread_safe (~> 0.1) unicode-display_width (1.3.0) - uuidtools (2.1.5) + uuidtools (2.2.0) websocket (1.2.2) + zeitwerk (2.4.2) PLATFORMS ruby diff --git a/lib/uuidable/active_record.rb b/lib/uuidable/active_record.rb index b379935..bb85980 100644 --- a/lib/uuidable/active_record.rb +++ b/lib/uuidable/active_record.rb @@ -21,7 +21,7 @@ module ClassMethods def uuidable(as_param: true) after_initialize { self.uuid = Uuidable.generate_uuid if attributes.keys.include?('uuid') && uuid.blank? } - validates :uuid, presence: true, uniqueness: true + validates :uuid, presence: true, uniqueness: true, if: :uuid_changed? if as_param define_method :to_param do diff --git a/lib/uuidable/version.rb b/lib/uuidable/version.rb index 1eae327..fa142a5 100644 --- a/lib/uuidable/version.rb +++ b/lib/uuidable/version.rb @@ -1,3 +1,3 @@ module Uuidable - VERSION = '0.2.4'.freeze + VERSION = '0.2.5'.freeze end