Re: Strange Problem With Unwanted, Transient Caching

Mark Reginald James
Wed, 07 Mar 2007 15:11:12 -0000

Andrew Stewart wrote:

>    def edit
>      @order = Order.find_by_id(params[:id]) || Order.new
>      ...
>    end
>
> I noticed that when params[:id] is nil, the finder still retrieves an
> order -- the order whose id matches the :customer_id which is in my
> params hash.  Weird.
>
> I then noticed that if I ran the finder a second time, it correctly
> returned nil.  Weirder.
>
> And I found the same behaviour if I replaced the find_by_id with
> find_by_sql using the SQL statement it generated in the log.  A weird
> clue?

http://www.ruby-forum.com/topic/70940#164187

--
We develop, watch us RoR, in numbers too big to ignore.