Sha256: e6c56018ab892f8babc5b4eb9122ca5cba04dccf41eada570439a053969a6f83

Contents?: true

Size: 585 Bytes

Versions: 1

Compression:

Stored size: 585 Bytes

Contents

module Cardboard
  module ContentForInControllers
    # https://gist.github.com/hiroshi/985457
    def view_context
      super.tap do |view|
        (@_content_for || {}).each do |name,content|
          view.content_for name, content
        end
      end
    end
    def content_for(name, content) # no blocks allowed yet
      @_content_for ||= {}
      if @_content_for[name].respond_to?(:<<)
        @_content_for[name] << content
      else
        @_content_for[name] = content
      end
    end
    def content_for?(name)
      @_content_for[name].present?
    end  
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
cardboard_cms-0.3.1 lib/cardboard/helpers/content_for_in_controllers.rb