Module: Mongoid::Relations::Options
- Extended by:
- Options
- Included in:
- Options
- Defined in:
- build/mongoid-6.4/lib/mongoid/relations/options.rb
Overview
This module contains the validating logic for options passed to relation macros.
Constant Summary collapse
- COMMON =
These options are available to all relations.
[ :class_name, :counter_cache, :extend, :inverse_class_name, :inverse_of, :name, :relation, :validate ].freeze
Instance Method Summary collapse
-
#validate!(options) ⇒ true, false
Determine if the provided options are valid for the relation.
Instance Method Details
#validate!(options) ⇒ true, false
Determine if the provided options are valid for the relation.
34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'build/mongoid-6.4/lib/mongoid/relations/options.rb', line 34 def validate!() = [:relation]::VALID_OPTIONS + COMMON .keys.each do |key| if !.include?(key) raise Errors::InvalidOptions.new( [:name], key, ) end end true end |