module QA_Rails::ContentMarkdownCache

Public Instance Methods

_content_markdown_cache() click to toggle source
# File lib/qa-rails.rb, line 8
def _content_markdown_cache
  seconds = Rails.env == 'development' ? 1.second : 5.minutes
  key     = "/json/#{self.class.table_name}/#{self.id}/_content_markdown_cache"
  Rails.cache.fetch(key, :expires_in => seconds) do
    c = MarkdownTopicConverter.format(self.content.to_s)
    puts self.content.inspect, " - "*8, c
    c
  end
end