Sha256: 8e1ac0b5528d5220bd8c856d62345915253591f6a639bbbde53f36df66acbbb3
Contents?: true
Size: 519 Bytes
Versions: 4
Compression:
Stored size: 519 Bytes
Contents
module BlockyHelper def blocky(block_name, options={}, &block) page_path = options[:global] ? nil : request.path 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
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
blocky-0.0.11 | app/helpers/blocky_helper.rb |
blocky-0.0.10 | app/helpers/blocky_helper.rb |
blocky-0.0.9 | app/helpers/blocky_helper.rb |
blocky-0.0.8 | app/helpers/blocky_helper.rb |