Skip to content

Commit

Permalink
Ensure that ActiveRecord is not addressed unless it is defined
Browse files Browse the repository at this point in the history
  • Loading branch information
stonefield committed Nov 9, 2023
1 parent 0dc6c6d commit 8a4c61e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/shoulda/matchers/rails_shim.rb
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def generate_validation_message(
def serialized_attributes_for(model)
attribute_types_for(model).
inject({}) do |hash, (attribute_name, attribute_type)|
if attribute_type.is_a?(::ActiveRecord::Type::Serialized)
if Object.const_defined?('ActiveRecord::Type::Serialized') && attribute_type.is_a?(::ActiveRecord::Type::Serialized)
hash.merge(attribute_name => attribute_type.coder)
else
hash
Expand Down

0 comments on commit 8a4c61e

Please sign in to comment.