Re: Strange Problem With Unwanted, Transient Caching

Andrew Stewart
Wed, 07 Mar 2007 15:26:06 -0000

Mark,

On 7 Mar 2007, at 15:11, Mark Reginald James wrote:
> 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

Thank you -- that''s exactly what I was after.

I''ve spent several hours puzzling over this today so I''m very
grateful for the solution!

Regards,
Andy Stewart