Sha256: 913ecce561ddb71a3d05f8b5c9366b1f6f824b441d06dc3204cf41bd839ef8e2
Contents?: true
Size: 704 Bytes
Versions: 3
Compression:
Stored size: 704 Bytes
Contents
module Edifice module Forms module Helper # not sure why there isn't something like this in rails # # render the errors on an object in a fairly standard way: # # <ul class="errors"> # <li data-for="name">Name cannot be blank</li> # </ul> def render_errors(builder) errors = builder.object.errors messages = errors.full_messages content_tag :ul, :class => :errors do output = '' errors.each_with_index do |error, i| output << content_tag(:li, :'data-for' => "#{builder.object_name}_#{error[0]}") { messages[i] } end output.html_safe end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
edifice-forms-0.5.1 | lib/edifice-forms/helper.rb |
edifice-forms-0.5.0 | lib/edifice-forms/helper.rb |
edifice-forms-0.4.0 | lib/edifice-forms/helper.rb |