Sha256: 7cba779ebcebbda003c497e6638b5145c4668949d520355d548f4513a00e330e
Contents?: true
Size: 509 Bytes
Versions: 2
Compression:
Stored size: 509 Bytes
Contents
module StaticBlocks module StaticBlocksHelper def static_block_for(name, default = nil) Rails.cache.fetch("static_block::"+name.to_s) do StaticBlock.published.find_by_title(name.to_s).content || default || "StaticBlock for #{name.to_s} missing" end end def static_block_published?(name) Rails.cache.fetch("static_block::"+name.to_s) do StaticBlock.published.find_by_title(name.to_s) || false end end alias_method :s, :static_block_for end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
static_blocks-0.0.2 | lib/static_blocks/helpers.rb |
static_blocks-0.0.1 | lib/static_blocks/helpers.rb |