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:
parent
05731559a0
commit
eb4b64a65b
1 changed files with 3 additions and 4 deletions
|
@ -43,14 +43,13 @@ module BlogPostsHelper
|
||||||
end
|
end
|
||||||
|
|
||||||
def blog_post_teaser(post)
|
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
|
post.custom_teaser.html_safe
|
||||||
else
|
else
|
||||||
truncate(
|
truncate(post.body, {
|
||||||
post.body,
|
|
||||||
:length => RefinerySetting.find_or_set(:blog_post_teaser_length, 250),
|
:length => RefinerySetting.find_or_set(:blog_post_teaser_length, 250),
|
||||||
:preserve_html_tags => true
|
:preserve_html_tags => true
|
||||||
).html_safe
|
}).html_safe
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue