Class: JsonApi::Parameters::Handlers::DefaultHandlers::ToManyRelationHandler

Inherits:
BaseHandler
  • Object
show all
Includes:
ActiveSupport::Inflector
Defined in:
lib/jsonapi_parameters/default_handlers/to_many_relation_handler.rb

Instance Attribute Summary collapse

Attributes inherited from BaseHandler

#included, #relationship_key, #relationship_value

Instance Method Summary collapse

Methods inherited from BaseHandler

call, #find_included_object, #initialize

Constructor Details

This class inherits a constructor from JsonApi::Parameters::Handlers::DefaultHandlers::BaseHandler

Instance Attribute Details

#keyObject (readonly)

Returns the value of attribute key.



8
9
10
# File 'lib/jsonapi_parameters/default_handlers/to_many_relation_handler.rb', line 8

def key
  @key
end

#valsObject (readonly)

Returns the value of attribute vals.



8
9
10
# File 'lib/jsonapi_parameters/default_handlers/to_many_relation_handler.rb', line 8

def vals
  @vals
end

#with_inclusionObject (readonly)

Returns the value of attribute with_inclusion.



8
9
10
# File 'lib/jsonapi_parameters/default_handlers/to_many_relation_handler.rb', line 8

def with_inclusion
  @with_inclusion
end

Instance Method Details

#handleObject



10
11
12
13
14
15
16
17
18
# File 'lib/jsonapi_parameters/default_handlers/to_many_relation_handler.rb', line 10

def handle
  @with_inclusion = !relationship_value.empty?

  prepare_relationship_vals

  generate_key

  [key, vals]
end