Methods

Class/Module Index [+]

Quicksearch

Mongoid::Relations::Options

This module contains the validating logic for options passed to relation macros.

Constants

COMMON

These options are available to all relations.

Public Instance Methods

validate!(options) click to toggle source

Determine if the provided options are valid for the relation.

@example Check the options.

Options.validate!(:name => :comments)

@param [ Hash ] options The options to check.

@raise [ ArgumentError ] If the options are invalid.

@return [ true, false ] If the options are valid.

@since 2.1.0

# File lib/mongoid/relations/options.rb, line 33
def validate!(options)
  valid_options = options[:relation].valid_options.concat(COMMON)
  options.keys.each do |key|
    if !valid_options.include?(key)
      raise Errors::InvalidOptions.new(
        options[:name],
        key,
        valid_options
      )
    end
  end
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.