Reputation: 13
I'm building an application that contains a bunch of projects that are at various stages, and I need to list the completed projects, or the projects that are at various other stages. So to list the completed projects, I name a scope;
named_scope :current, :conditions => { :current_stage => "Completed" }
and use;
@projects = Project.current
in my controller.
But I how do I find all the projects at other stages? I thought it would involve != but I can't get that to work.
Any pointers very much appreciated.
Thanks a lot
Upvotes: 1
Views: 3768
Reputation: 113310
This should work:
named_scope :incomplete, :conditions => [ 'current_stage != "Completed"' ]
Upvotes: 8