AO3-4514: Fix chapter count cache when draft is first posted #2487

Merged
merged 1 commit into from Jul 10, 2016

2 participants

@elzj
Organization for Transformative Works member
elzj commented Jun 15, 2016 edited

https://otwarchive.atlassian.net/browse/AO3-4514

Trigger cache invalidation when a draft chapter is posted

@elzj elzj AO3-4514: Fix chapter count cache when draft is first posted
a61b85e
@houndci-bot houndci-bot commented on the diff Jun 15, 2016
app/models/chapter.rb
@@ -78,6 +78,8 @@ def fix_positions
end
end
+ after_save :invalidate_chapter_count,
+ if: Proc.new { |chapter| chapter.posted_changed? }

Align the parameters of a method call if they span more than one line.
Use proc instead of Proc.new.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@sarken
Organization for Transformative Works member

Looks good to me! (For anyone driving by and wondering why I'm not asking about automated tests, the Chapters: 0/1 bug wasn't reproducible in them.)

@sarken sarken merged commit 9d30150 into otwcode:master Jul 10, 2016

2 checks passed

Details continuous-integration/travis-ci/pr The Travis CI build passed
hound 2 violations found.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment