Sha256: 6cc8d430f5ebe58d9e45f7aa3fb58947547945446a089251b65867e46d0599c9
Contents?: true
Size: 587 Bytes
Versions: 12
Compression:
Stored size: 587 Bytes
Contents
module StaticBlocks module SnippetsHelper def snippet_for(title, default = nil) Rails.cache.fetch("snippet::"+I18n.locale.to_s+"::"+title.to_s) do snippet = Snippet.published.find_by_title(title.to_s) if snippet snippet.content else "Snippet for #{title.to_s} missing" end end end def snippet_published?(title) Rails.cache.fetch("snippet::"+I18n.locale.to_s+"::"+title.to_s) do Snippet.published.find_by_title(title.to_s) || false end end alias_method :s, :snippet_for end end
Version data entries
12 entries across 12 versions & 1 rubygems