app/controllers/runs_controller.rb
# render errors of commit on committing page
# CAUTION: applicable only when request is xhr
render errors of commit on committing page
CAUTION: applicable only when request is xhr
render errors of commit on committing page CAUTION : applicable only when request is xhr
def render_error_messages(e)
    all_errors = e.record.set_of_all_errors || [e]
    render :update do |page|
      all_errors.each do |e|
        entity = e.record
        entity_id = entity.entity_id
        errors = entity.errors
        page.assign "error_size", errors.size
        page.assign "spotted_error_count", 0
        errors.each do |attr, msg|
          message     = msg.is_a?(Array) ? msg.join('<br />') : msg
          page.assign "error_count", (msg.is_a?(Array) ? msg.size : 1)
          page.select("*[entity_id='#{entity_id}'] .validity-error-message.#{attr}").each do |field|
            page.replace_html field, message
            field.visual_effect :highlight
            page << "spotted_error_count += error_count"
          end
        end
        residue_error_message = errors.full_messages.join('\n')
        page << "if( error_size - spotted_error_count > 0 ) alert('#{residue_error_message}')"
        errors.clear
      end
    end
  end
def render_error_messages ( e ) all_errors = e . record . set_of_all_errors || [ e ] render :update do | page | all_errors . each do | e | entity = e . record entity_id = entity . entity_id errors = entity . errors page . assign "error_size" , errors . size page . assign "spotted_error_count" , 0 errors . each do | attr , msg | message = msg . is_a? ( Array ) ? msg . join ( '<br />' ) : msg page . assign "error_count" , ( msg . is_a? ( Array ) ? msg . size : 1 ) page . select ( "*[entity_id='#{entity_id}'] .validity-error-message.#{attr}" ) . each do | field | page . replace_html field , message field . visual_effect :highlight page << "spotted_error_count += error_count" end end residue_error_message = errors . full_messages . join ( '\n' ) page << "if( error_size - spotted_error_count > 0 ) alert('#{residue_error_message}')" errors . clear end end end
render errors of commit on committing page
CAUTION: applicable only when request is xhr
render errors of commit on committing page CAUTION : applicable only when request is xhr
# for errors unspotted by attributes
e
<not_specific>