 难道 find 有缓存
难道 find 有缓存
def find_one(id)
  id = id.id if ActiveRecord::Base === id
  if IdentityMap.enabled? && where_values.blank? &&
    limit_value.blank? && order_values.blank? &&
    includes_values.blank? && preload_values.blank? &&
    readonly_value.nil? && joins_values.blank? &&
    !@klass.locking_enabled? &&
    record = IdentityMap.get(@klass, id)
    return record
  end
  column = columns_hash[primary_key]
  substitute = connection.substitute_at(column, @bind_values.length)
  relation = where(table[primary_key].eq(substitute))
  relation.bind_values = [[column, id]]
  record = relation.first
  unless record
    conditions = arel.where_sql
    conditions = " [#{conditions}]" if conditions
    raise RecordNotFound, "Couldn't find #{@klass.name} with #{primary_key}=#{id}#{conditions}"
  end
  record
end
如果 IdentityMap 没开应该没缓存啊。
装了什么插件吗?
#3 楼 @Rei https://github.com/lshgo/mongo_organizational 可能是转换模型 database 的问题吧!但是 where 怎么会没有查到呢!
Industry.where(:id => "503f06b7e13823df08000004").first
  MOPED: 127.0.0.1:27017 QUERY        database=neza_public_development collection=industries selector={"$query"=>{"_id"=>"503f06b7e13823df08000004"}, "$orderby"=>{:_id=>1}} flags=[] limit=-1 skip=0 fields=nil (0.6375ms)
 => #<Industry _id: 503f06b7e13823df08000004, _type: nil, created_at: 2012-08-30 06:22:47 UTC, updated_at: 2012-08-30 06:22:47 UTC, name: "**", alias_name: "***"> 
