Rails scope with 2 where clauses

I have a rails scope statement where I want 2 where clauses. (I will clean up the hardcoding when I've got it working).

This is in my workorder model:

  scope :laborok, where("wostatus_id NOT IN (?)", [231, 230, 8466, 8467, 232] ) and where("maxsynch = (?)", "N" )

The logic is if the workorder status (wostatus.id) is not one on the values and the workorder.maxsynch is equal to "N"


you can chain the where() methods:

scope :laborok, where("wostatus_id NOT IN (?)", [1]).where("maxsynch = (?)", "N")

Whatch out, I replaced your array of IDs with [1]! Here is the code with your array of IDs:

scope :laborok, where("wostatus_id NOT IN (?)", [231, 230, 8466, 8467, 232]).
                  where("maxsynch = (?)", "N")

Need Your Help

List of objects that have a list of other objects as one of their parameters

list object

I have this object Object1 defined as public Object1(String item, List<Object2> obj2) in a class (whilst Object2 is defined in another class as public Object2(String item1, String item2))

Bootstrap 3 menu dropdown strange BUG

javascript css html5 css3 twitter-bootstrap-3

I am making a site usng bootstrap 3. Now the problem is with navbar dropdown.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.