Andrew Kaspick wrote:

    options = {:limit => 10}

    logger.debug Division.find(1).teams.find(:all, options)
    logger.debug Division.find(2).teams.find(:all, options)
    logger.debug Division.find(3).teams.find(:all, options)

This produces the following sql in the order seen in the controller
(notice how the WHERE clause keeps getting appended too?)

SELECT * FROM teams WHERE (teams.division_id = 1)
SELECT * FROM teams WHERE (teams.division_id = 2 AND
(teams.division_id = 1)) LIMIT 10
SELECT * FROM teams WHERE (teams.division_id = 3 AND
(teams.division_id = 2 AND (teams.division_id = 1))) LIMIT 10


So the options are being modified on subsequent calls here which I
would say is not good.  This is a narrowed down example from some real
code I'm using, but the essence of the problem is the same.  I dug
around some of the rails code, but didn't see anything obvious right
away.

The problem that the method extract_options_from_args! is not dup-ing
the args of find.
_______________________________________________
Rails-core mailing list
Rails-core@lists.rubyonrails.org
http://lists.rubyonrails.org/mailman/listinfo/rails-core

Reply via email to