I have three models "Input", "Mechanism", and "Output".

Mechanism 'has\_one' :input and 'has\_one' :output.

I want it make it so that a Mechanism object has the name attribute
"The effect of input X on output Y".

Here is what I tried:

```
class Mechanism
  include Neo4j::ActiveNode
  property :name, default: 'NewMechanism#{self.class.count}'
  has_one :in, :input,  class_name: 'Input'
  has_one :out, :output,  class_name: 'Output'
  after_create :name_mechanism
  def name_mechanism
     self.update_attributes(name: "Effect of #{self.input.name} on #{self.output.name}")
  end
end

```

But when I initialize an object in the console, I get the error 

> 
> NoMethodError: undefined method `name' for nil:NilClass from app/models/mechanism.rb:12:in 'name\_mechanism'
> 
> 
> 

So yeah I am using Neo4j as a database, but I suspect this isn't a neo4j issue, but rather it is my weak understanding of callbacks in Rails. Any advice?