Module: Neo4j::ActiveNode::Dependent::AssociationMethods

Included in:
HasN::Association
Defined in:
lib/neo4j/active_node/dependent/association_methods.rb

Instance Method Summary collapse

Instance Method Details

#add_destroy_callbacks(model) ⇒ Object



9
10
11
12
13
14
15
# File 'lib/neo4j/active_node/dependent/association_methods.rb', line 9

def add_destroy_callbacks(model)
  return if dependent.nil?

  model.before_destroy(&method("dependent_#{dependent}_callback"))
rescue NameError
  raise "Unknown dependent option #{dependent}"
end

#validate_dependent(value) ⇒ Object



5
6
7
# File 'lib/neo4j/active_node/dependent/association_methods.rb', line 5

def validate_dependent(value)
  fail ArgumentError, "Invalid dependent value: #{value.inspect}" if not valid_dependent_value?(value)
end