Sha256: 02a03094af4aa7d7a32766db6357853f9c489b5b5e9d13af2ae1322b7cee8d78

Contents?: true

Size: 364 Bytes

Versions: 1

Compression:

Stored size: 364 Bytes

Contents

module BlockyHelper

  def blocky(block_name, options={})
    page_path = options[:global] ? nil : request.fullpath

    content_block = Blocky::ContentBlock.where({
      page_path: page_path,
      name: block_name
    }).first_or_create

    Rails.cache.fetch(content_block, skip_digest: options[:global]) do
      raw(content_block.content)
    end
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
blocky-0.0.4 app/helpers/blocky_helper.rb