Ensure that the custom_teaser column exists before trying to use it incase the migration hasn't been generated/run.

This commit is contained in:
Philip Arndt 2011-06-27 10:25:44 +12:00
parent 05731559a0
commit eb4b64a65b

View file

@ -43,14 +43,13 @@ module BlogPostsHelper
end
def blog_post_teaser(post)
if post.custom_teaser.present?
if post.respond_to?(:custom_teaser) && post.custom_teaser.present?
post.custom_teaser.html_safe
else
truncate(
post.body,
truncate(post.body, {
:length => RefinerySetting.find_or_set(:blog_post_teaser_length, 250),
:preserve_html_tags => true
).html_safe
}).html_safe
end
end
end