lib/formula.rb
def block(method = nil, options = {}, &block)
      options[:error] ||= error(method) if method

      components = "".html_safe

      if method
        components << self.label(method, options[:label]) if options[:label] or options[:label].nil? and method
      end

      components << @template.capture(&block)

      options[:container] ||= {}
      options[:container][:class] = arrayorize(options[:container][:class]) << ::Formula.block_class << method
      options[:container][:class] << ::Formula.block_error_class if ::Formula.block_error_class.present? and error?(method)

      components << @template.content_tag(::Formula.hint_tag , options[:hint ], :class => ::Formula.hint_class ) if options[:hint ]
      components << @template.content_tag(::Formula.error_tag, options[:error], :class => ::Formula.error_class) if options[:error]

      @template.content_tag(::Formula.block_tag, options[:container]) do
        components
      end
    end
def block(method = nil, options = {}, &block)
      options[:error] ||= error(method) if method

      components = "".html_safe

      if method
        components << self.label(method, options[:label]) if options[:label] or options[:label].nil? and method
      end

      components << @template.capture(&block)

      options[:container] ||= {}
      options[:container][:class] = arrayorize(options[:container][:class]) << ::Formula.block_class << method
      options[:container][:class] << ::Formula.block_error_class if ::Formula.block_error_class.present? and error?(method)

      components << @template.content_tag(::Formula.hint_tag , options[:hint ], :class => ::Formula.hint_class ) if options[:hint ]
      components << @template.content_tag(::Formula.error_tag, options[:error], :class => ::Formula.error_class) if options[:error]

      @template.content_tag(::Formula.block_tag, options[:container]) do
        components
      end
    end
Basic container generator for use with blocks.

 Options:

 * :hint       - specify a hint to be displayed ('We promise not to spam you.', etc.)
 * :label      - override the default label used ('Name:', 'URL:', etc.)
 * :error      - override the default error used ('invalid', 'incorrect', etc.)

 Usage:

   f.block(:name, :label => "Name:", :hint => "Please use your full name.", :container => { :class => 'fill' }) do
     ...
   end

 Equivalent:

   <div class='block fill'>
     <%= f.label(:name, "Name:") %>
     ...
     <div class="hint">Please use your full name.</div>
     <div class="error">...</div>
   </div>