hooopo/second_level_cache

在处理has_many时preloader会导致exception

Closed this issue · 1 comments

在controller中处理类似下面的代码时,如果Post也enable了cache会导致expcetion:

Topic.includes(:posts).where(:status => 'published' )

查看了一下代码,发现在处理includes时,preloader会将ids当做Post的primary id去查找已经缓存的posts,但是在has_many中ids是Post的topic_id而不是Post的 primary id。

I think #13 has solved this, thanks.