From 9c090c862f96faf228c9bd839b2e91a68398168e Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Tue, 12 Aug 2014 11:52:16 -0400 Subject: [PATCH] Ask about 'Draft' before asking about 'Post' `Draft`s are a subclass of `Post` so `draft.is_a?(Post)` will return `true`, thus making all `Draft`s `Post`s, which is not desired. If asking about `Draft` first, then we avoid this problem. Fixes #2726 --- lib/jekyll/convertible.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/jekyll/convertible.rb b/lib/jekyll/convertible.rb index 68cb2b2a..8c8a14d0 100644 --- a/lib/jekyll/convertible.rb +++ b/lib/jekyll/convertible.rb @@ -128,12 +128,12 @@ module Jekyll # # Returns the type of self. def type - if is_a?(Post) + if is_a?(Draft) + :drafts + elsif is_a?(Post) :posts elsif is_a?(Page) :pages - elsif is_a?(Draft) - :drafts end end