Skip to content

Commit

Permalink
make sure attributes getter is defined
Browse files Browse the repository at this point in the history
  • Loading branch information
jamis committed Feb 26, 2024
1 parent 55d90cc commit 4070f4d
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lib/mongoid/validatable/associated.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@ module Validatable
# validates_associated :name, :addresses
# end
class AssociatedValidator < ActiveModel::Validator
# Required by `validates_with` so that the validator
# gets added to the correct attributes.
def attributes
options[:attributes]
end

# Checks that the named associations of the given record
# (`attributes`) are valid. This does NOT load the associations
# from memory, and will only validate records that are dirty
Expand Down

0 comments on commit 4070f4d

Please sign in to comment.