This project is archived and is in readonly mode.
calling named scope in class method
-
josh
- Assigned user set to Pratik
- Tag set to bug, named_scope, tested
-
Pratik
- State changed from new to invalid
This would happen because you're calling approved_through_class_method on Scope object. In case of Topic.replied.approved, Scope#method_missing checks @@scopes hash to see if :approved is a named scope or not. Wherein case of Topic.replied.approved_through_class_method, there is no way to determine if approved_through_class_method is going to return a named scope or not.
The real solution to this would be very fugly and in no way not worth it.
So the practical solution : Define the method in named scope extension.
named_scope :replied, :conditions => ['replies_count > 0'] do def approved_through_class_method approved end end