module Cell::Rails::Capture::ContentForExtension
Public Instance Methods
content_for(name, content=nil, &block)
click to toggle source
# File lib/cells_capture.rb, line 23 def content_for(name, content=nil, &block) # this resembles rails' own #content_for INTENTIONALLY. Due to some internal rails-thing we have to call #capture on the cell's view, otherwise, # rails wouldn't suppress the captured output. uncomment next line to provoke. #cnt = @tpl.capture(&block) if content || block_given? content = capture(&block) if block_given? @global_tpl.view_flow.append(name, content) if content nil else @view_flow.get(name) end # i would love to simply do this: # TODO: refactor rails helper. #@tpl.content_for(*args, &block) #nil end