开发者

Scopes Causing undefined method `const_defined?'

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!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜