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) ⇒ void
Checks attribute :many option must be provided with relations.
Class Method Details
.call(opts) ⇒ void
This method returns an undefined value.
Checks attribute :many option must be provided with relations
20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/serega/plugins/explicit_many_option/validations/check_opt_many.rb', line 20 def call(opts) serializer = opts[:serializer] return unless serializer 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" end |