Skip to content

Commit

Permalink
Merge pull request #48 from BjarneD/validate-method-based-on-existence
Browse files Browse the repository at this point in the history
Don't require ActiveRecord
  • Loading branch information
michaelbanfield authored Apr 28, 2024
2 parents 22ed469 + 38c3ce2 commit 70d01e8
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/devise/pwned_password/model.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ module PwnedPassword

included do
validate :not_pwned_password,
if: (defined?(ActiveRecord) && ActiveRecord.gem_version >= Gem::Version.new("5.1.x")) ? :will_save_change_to_encrypted_password? : :encrypted_password_changed?
if: respond_to?(:will_save_change_to_encrypted_password?) ? :will_save_change_to_encrypted_password? : :encrypted_password_changed?
end

module ClassMethods
Expand Down

0 comments on commit 70d01e8

Please sign in to comment.