Krzysztof Witczak
Krzysztof Witczak

Reputation: 512

Rails fragment caching after database reset

I'm using fragment caching in Rails and it works really well. But after db:reset, which occurs common at this stage of the project, the last used fragment cache still applies.

How can I expire it together with db:reset? Is the only solution creating new rake task with other name that bundles db:reset with expire_fragment?

Upvotes: 0

Views: 43

Answers (1)

Basten Gao
Basten Gao

Reputation: 298

rake tmp:cache:clear would clean fragment caching

Enhance db:reset task

Rake::Task["db:reset"].enhance do
  Rake::Task["tmp:cache:clear"].invoke
end

Upvotes: 1

Related Questions