Wednesday, December 3, 2008

Use of concat tag

This example shows how to use concat tags in helper class, also note the use of rendering partial template inside this.


def content_headers(header = '', sub_header = '', options = {}, &block)
if !options.has_key?(:if) || options[:if]
content_body = capture(&block)
concat(render(:partial => 'shared/content_headers',
:locals => { :body => content_body, :header => header, :sub_header => sub_header }),
block.binding)
end

end

No comments: