In Rails, how do I find records by "not equal"

Posted by Mazonowicz on Stack Overflow See other posts from Stack Overflow or by Mazonowicz
Published on 2010-03-29T22:47:18Z Indexed on 2010/03/29 22:53 UTC
Read the original article Hit count: 108

Filed under:

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

© Stack Overflow or respective owner

Related posts about ruby-on-rails