Sha256: 32576e85e769715bf11c8de1ac3d77ceec25858a72acc9f4e9941b3c245aa716
Contents?: true
Size: 698 Bytes
Versions: 1
Compression:
Stored size: 698 Bytes
Contents
module NicePartials class Partial def initialize(view_context) @view_context = view_context @key = SecureRandom.uuid end def yield(name = nil) raise "You can only use Nice Partial's yield method to retrieve the content of named content area blocks. If you're not trying to fetch the content of a named content area block, you don't need Nice Partials! You can just call the vanilla Rails `yield`." unless name content_for(name) end def helpers(&block) class_eval &block end def content_for(name, content = nil, options = {}, &block) @view_context.content_for("#{name}_#{@key}".to_sym, content, options, &block) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
nice_partials-0.1.1 | lib/nice_partials/partial.rb |