# Non-SQL conditions in finder?

**URL:** <https://www.ruby-forum.com/t/non-sql-conditions-in-finder/121544>\
**Category:** Rails\
**Created:** [November 28, 2007, 8:35pm UTC](https://www.ruby-forum.com/t/non-sql-conditions-in-finder/121544 "2007-11-28T20:35:00Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![eric99](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/a88e4f/32.png) [@eric99](https://www.ruby-forum.com/u/eric99)\
**Post date:** [November 28, 2007, 8:35pm UTC](https://www.ruby-forum.com/t/non-sql-conditions-in-finder/121544/1 "2007-11-28T20:35:00Z")

</div>

find lets me specify SQL conditions like this:  
Product.find :all, :conditions =\> “price \> 100”

where price is a SQL column.

But in my Product model, price is actually a virtual attribute that’s  
calculated based on the the prices of its components. Is there a way to  
specify virtual attributes as part of a finder condition? Right now my  
only  
choice is to implement a method “find\_all\_expensive\_products” in Product  
that loops through all the products returned by find :all and check for  
the  
virtual attribute one by one.

Any thoughts?
