Class: Serega::SeregaPlugins::ExplicitManyOption::CheckOptMany
- Inherits:
-
Object
- Object
- Serega::SeregaPlugins::ExplicitManyOption::CheckOptMany
- Defined in:
- lib/serega/plugins/explicit_many_option/validations/check_opt_many.rb
Overview
Validator for attribute :many option
Class Method Summary collapse
-
.call(opts, block = nil) ⇒ void
Checks attribute :many option must be provided with relations (attributes with the :serializer option or a block defining a nested serializer).
Class Method Details
.call(opts, block = nil) ⇒ void
This method returns an undefined value.
Checks attribute :many option must be provided with relations (attributes with the :serializer option or a block defining a nested serializer)
24 25 26 27 28 29 30 31 32 33 |
# File 'lib/serega/plugins/explicit_many_option/validations/check_opt_many.rb', line 24 def call(opts, block = nil) return if !opts[:serializer] && !block many_option_exists = opts.key?(:many) return if many_option_exists raise SeregaError, "Attribute option :many [Boolean] must be provided" \ " for attributes with :serializer option or a block" end |