1module FormHelper
  • DuplicateMethodCall - calls 'opts[:class]' 2 times » reek
  • DuplicateMethodCall - calls 'opts[:for]' 3 times » reek
  • FeatureEnvy - refers to 'opts' more than self (maybe move it to another class?) » reek
  • Complexity 3 » saikuro
2  def form_row opts={}, &block
 
3    css_classes = ['form-group']
 
4    css_classes.push opts[:class] if opts[:class]
 
5    css_classes.push 'error' if opts[:for] && opts[:for][0].errors[opts[:for][1]].any?
 
6    content_tag :div, capture(&block), :class => css_classes.join(' ')
 
7  end
 
8
  • UtilityFunction - doesn't depend on instance state (maybe move it to another class?) » reek
  • Complexity 1 » saikuro
 9  def countries_for_select
 
10    Location.menu
 
11  end
 
  • Complexity 2 » saikuro
13  def error_messages_for_field(object, field_name, options = {})
  • Found = in conditional. It should probably be an == » roodi
14    if errors = object && object.errors[field_name].presence
 
15      content_tag :span, errors.first, { class: 'error-message' }.merge(options)
 
16    end
 
17  end
 
18end