# Checkout coreyward's answer to the question here: Creating a model that has a tree structure
# Basically you want to add a "parent_id" field to your folders table and then set up a relationship in your Folder model like this:
belongs_to :parent, :class_name => "Folder"
has_many :folders, :foreign_key => "parent_id"
# OR
belongs_to :parent, class_name: 'Campaign', touch: true
has_many :children, class_name: 'Campaign', foreign_key: 'parent_id', order: :priority, dependent: :destroy, inverse_of: :parent