Method: Neo4j::ActiveRel::Types::ClassMethods#type

Defined in:
lib/neo4j/active_rel/types.rb

#type(given_type = nil, auto = false) ⇒ Object Also known as: rel_type, _type

When called without arguments, it will return the current setting or supply a default. When called with arguments, it will change the current setting.

Parameters:

  • given_type (String) (defaults to: nil)

    sets the relationship type when creating relationships via this class

  • auto (Boolean) (defaults to: false)

    Should the given_type be changed in compliance with the gem’s rel decorator setting?



35
36
37
38
39
40
41
42
43
44
# File 'lib/neo4j/active_rel/types.rb', line 35

def type(given_type = nil, auto = false)
  case
  when !given_type && rel_type?
    @rel_type
  when given_type
    assign_type!(given_type, auto)
  else
    assign_type!(namespaced_model_name, true)
  end
end