Sha256: 2413adce58d4f7a278331fd0743b85e6b77f6e8a5704a8f44e47aca98edb2649

Contents?: true

Size: 498 Bytes

Versions: 2

Compression:

Stored size: 498 Bytes

Contents

module Grandstand
  module FormBuilder
    def errors_on(*fields)
      if @object
        errors = []
        fields.each do |field|
          @object.errors[field].each do |error|
            errors.push("<li>#{error[0, 1] == error[0, 1].upcase ? error : "#{field.to_s.humanize} #{error}"}</li>")
          end
        end
        unless errors.empty?
          @template.content_tag(:ul, :class => 'errors') do
            errors.join("\n")
          end
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
grandstand-0.2.7 lib/grandstand/form_builder.rb
grandstand-0.2.6 lib/grandstand/form_builder.rb