Module: StaticBlocks::StaticBlocksHelper
- Defined in:
- lib/static_blocks/helpers.rb,
app/helpers/static_blocks/static_blocks_helper.rb
Instance Method Summary collapse
Instance Method Details
#static_block_for(name, default = nil) ⇒ Object Also known as: s
3 4 5 6 7 |
# File 'lib/static_blocks/helpers.rb', line 3 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 |
#static_block_published?(name) ⇒ Boolean
9 10 11 12 13 |
# File 'lib/static_blocks/helpers.rb', line 9 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 |