In jdbc_oracle, to implement the Sequence as part of "insert", the insert method of Active Record is overridden.
But this effectively negates the query cache logic. The impact is as follows
a = SomeModel.find(:all)
- outputs no records
SomeModel.insert(...)
a = SomeModel.find(:all)
- outputs no records
In the above scenario, after an insert, query cache logic in AR base ensures that the cache is invalidated so that subsequent find is not read from cache
But, in Oracle's case, since the insert method itself is overridden, this logic is eaten.
I have fixed the same and have tested in my project. I am attaching the code snippet below. It would be good to have this fix made available in your code base.
Step 1: put the following code snippet in jdbc_oracle.rb
def self.extended(object)
object.class_eval do
alias_chained_method :insert, :query_dirty, :jdbc_insert
end
end
Step 2: Rename the "insert" method to "jdbc_insert"
Thanks, applied in 62c96d7.