ActiveRecord, Pulling Out Finders Into Extensions


I've been thinking of this for a while. At least, if I'm reading what
you're saying right, I have.

To me, this is what I've wanted.

Any object that implements .to_sql(connection) should be allowed as a condition.

#A useless stub example.
class Array
  def to_sql(connection)

Basically, this would open up any crazy-idea that anyone wants to
implement for conditions.

ActiveSupport would implement the default Object#to_sql(con) methods.

Thoughts on this API?


Oh wait, one pretty example

class SearchObject
  def initialize(params)
    #build state

  def to_sql(conn)
    #build my sql call

So, you could easily do this.

User.find(:all, :condition =>[:user]))

Crazy! I want to do this!