Looking to limit a find based on conditions in a Rails 2.0.2.
Find statement:
@employees = Employee.find_by_contents(params[:keywords].to_s, :include => [ :categories, :revisions, :approvals, :archives, :related_documents ])
Need to add a condition to limit find
:conditions=>["archived = '0'"]
Though this doesn't work
@employees = Employee.find_by_contents(params[:keywords].to_s, :include => [ :categories, :revisions, :approvals, :archives, :related_documents ], :conditions=>["archived = '0'"])
Anyone know what the syntax should be?
Was having quite a time with adding a condition to ferret find_by, so I added a post command to filter if it's archived. If you think of a better way still, let me know. Thanks.
@employees = Employee.find_by_contents(params[:keywords].to_s,
:include => [ :categories, :revisions, :approvals,
:archives, :related_documents ])
@employees = @employees.find_all {|p| !p.archived}