small medium large xlarge

13 Jun 2016, 02:39
Graham Menhennitt (2 posts)

I’m working through creating the depot app and am at the end of iteration C5. As soon as I turn the caching on, I get three duplicate entries in my stores. Instead of the three different books, I get three copies of “Rails, Angular, Postgres, and Bootstrap”. If I remove the two “cache” calls from app/views/store/index.html.erb (and the two corresponding “end”s), it works correctly. Put them back in and I get the duplicates.

I downloaded the depot_e source code and it doesn’t show the same problem. I’ve tried diffing the two sets of source (my generated one and the downloaded one) but there are too many differences to see what the problem is.

Ruby is 2.2.5 and rails is 5.0.0.rc1.

Does anybody have any clues, please?

Thanks, Graham

18 Jun 2016, 05:27
Graham Menhennitt (2 posts)

Answering my own question…

I spent time diffing between my copy of the depot app and the one downloaded. I had a empty file in my copy that must have been created by Rails at some stage. Removing that file fixed the problem. All I had to do was:

rm tmp/caching-dev.txt

A bit of googling for that file name tells me that it’s created when you do “rails dev:cache”. If I do that, the file is recreated and the application doesn’t work correctly again.

I had a look at the errata for the book and, sure enough, it’s a bug in the book. I need to remove the ‘@’ from before ‘product’ in the line:

cache product do

Now it works!


You must be logged in to comment