inside the block_code method inside of CodeRayify class:
module BlogsHelper
def gravatar_helper user
image_tag "https://www.gravatar.com/avatar/#{Digest::MD5.hexdigest(user.email)}", width: 60
end
class CodeRayify < Redcarpet::Render::HTML
def block_code(code, language)
CodeRay.scan(code, language).div
end
end
def markdown(text)
coderayify = CodeRayify.new(filter_html: true, hard_wrap: true)
options = {
fenced_code_blocks: true,
no_intra_emphasis: true,
autolink: true,
lax_html_blocks: true,
}
markdown_to_html = Redcarpet::Markdown.new(coderayify, options)
markdown_to_html.render(text).html_safe
end
def blog_status_color blog
'color: red;' if blog.draft?
end
end
I was wondering if this was a known error or if someone can assist me to identify if CodeRay.scan(code, language).div is no longer a valid way to write this.
Today I started to get this error after I uploaded my latest blog:
ActionView::Template::Error (Symbol or String expected, but NilClass given.)
I noticed I only got the error when I was signed in as admin.
I looked at my heroku logs which referenced code that was tied to my admin_actions partial:
but the logs also references:
2017-11-21T22:43:24.204407+00:00 app[web.1]: F, [2017-11-21T22:43:24.204360 #4] FATAL -- : [58b9a24b-3a61-4e43-8e61-c92eb08c5258] app/helpers/blogs_helper.rb:8:in
block_code'`which is:
CodeRay.scan(code, language).div
inside the block_code method inside of CodeRayify class:
I was wondering if this was a known error or if someone can assist me to identify if
CodeRay.scan(code, language).div
is no longer a valid way to write this.