I have a model:
class Files < ActiveRecord::Base belongs_to :parent, class_name: "Files" end
As in a file system, I want the root entry to point to itself. I’ve tried various things but it always ends up with the parent field being null and the DB throws an error because the parent field can’t be null.
I could, I suppose, allow nulls and have the root entry have a null parent but I’d like to know how to do this anyway.