Basically, I defined a property on my model which returns true or false depending on values in another table.
What I want is to have my Index action in the controll
The Rails query methods (like where) work by creating a database query; in other words, you can't use an attribute in where unless it actually exists on your data model. Otherwise, the database doesn't know about it and can't perform the filtering for you.
In your case, you should define a method on the Project class which performs the "is available?" query, so you can use your method in place of where. You can do it like this:
class Project < ActiveRecord::Base
def self.available_projects
where('workers_count > 2')
end
end
See MrYoshiji's answer for specifics on how to write the query or how to define it as a named scope.