Sha256: 47081814e8188a3258526a4dbe9a10454ba3f114aa80f0363c8c093c8a2987ae
Contents?: true
Size: 523 Bytes
Versions: 3
Compression:
Stored size: 523 Bytes
Contents
module BlockyHelper def blocky(block_name, options={}, &block) page_path = options[:global] ? nil : request.fullpath content_block = Blocky::ContentBlock.where({ page_path: page_path, name: block_name }).first_or_initialize if content_block.new_record? if block_given? content_block.content = capture(&block) end content_block.save end Rails.cache.fetch(content_block, skip_digest: options[:global]) do raw(content_block.content) end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
blocky-0.0.7 | app/helpers/blocky_helper.rb |
blocky-0.0.6 | app/helpers/blocky_helper.rb |
blocky-0.0.5 | app/helpers/blocky_helper.rb |