我有以下类别模型:
class Category < ActiveRecord::Base
belongs_to :parent, :class_name => "Category", :foreign_key => "parent_id"
has_many :categories, :class_name => "Category", :foreign_key => "parent_id"
end
我希望能够按父类别过滤并在添加/编辑类别中选择父类别
我有以下类别模型:
class Category < ActiveRecord::Base
belongs_to :parent, :class_name => "Category", :foreign_key => "parent_id"
has_many :categories, :class_name => "Category", :foreign_key => "parent_id"
end
我希望能够按父类别过滤并在添加/编辑类别中选择父类别