ActiveRecord, Pulling Out Finders Into Extensions

Dennis-

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)
    connection.quote(self.to_s)
  end
end

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?

-hampton.

Oh wait, one pretty example

class SearchObject
  def initialize(params)
    #build state
  end

  def to_sql(conn)
    #build my sql call
  end
end

So, you could easily do this.

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

Crazy! I want to do this!

-hampton.