I am working on a project where I have a Process object that references
a Node object. I have tried adding a node_id column in the Process
table and created an has_one relationship in the Process model.
When trying Process.node.create(@attr) am getting an error as the sql is
trying to update the process_id column in the Node table. I dont want
to add a process_id column in the node table as most nodes will not
refer to a process (ie one way association between process and node).
I am working on a project where I have a Process object that references
a Node object. I have tried adding a node_id column in the Process
table and created an has_one relationship in the Process model.
Change that relationship definition to a belongs_to rather than a
has_one.
I am working on a project where I have a Process object that references
a Node object. I have tried adding a node_id column in the Process
table and created an has_one relationship in the Process model.
If you have node_id in Process then you want process belongs_to node.
Have a look at the Rails Guide on ActiveRecord Associations for more
information.
I am working on a project where I have a Process object that references
a Node object. I have tried adding a node_id column in the Process
table and created an has_one relationship in the Process model.
Change that relationship definition to a belongs_to rather than a has_one.