I have a question about circular references. How would I accomplish this?
I want to make a Category that can have any number of sub-categories.
Would it just be like this?
Any help would be greatly appreciated.
(I apologise, I'm pretty new at this)
-------------------------
Call me barely Impressive Captain.
I want to make a Category that can have any number of sub-categories.
Would it just be like this?
Code:
class Category < ActiveRecord::Base
belongs_to :category, has_many :category, :class_name => "Category", :foreign_key => "parent_id"
end
Any help would be greatly appreciated.
(I apologise, I'm pretty new at this)
-------------------------
Call me barely Impressive Captain.