Here's my scopes:
scope :parents, where("categories.parent_category_id IS NULL")
scope :children_of, lambda { |parent| where("categories.parent_category_id = ?", parent) }
I'm not totally sure what'开发者_StackOverflow中文版s wrong with them though. Any help would be appreciated. Thanks!
Update:
This is the error...
undefined method `const_defined?' for #<Category:0x112ccfdb8>
And here's the full trace: https://gist.github.com/1186122
Having a scope called parents
also breaks acts_as_nested_set
v1.4.4
It looks like having a scope called parents
breaks if you have acts_as_tree v0.1.1 with rails 3.0.10.
I had the gem acts_as_tree used in the Category model which was breaking the scopes I was making. It's all fixed now. Thanks!
精彩评论