Skip to content

Commit

Permalink
@options.fetch(:errors, {}) can be nil
Browse files Browse the repository at this point in the history
If the key `:errors` exists in `@options` then the previous code will return `nil`.

Changing it like this ensures we have a hash if errors did not exist or if it was nil.
  • Loading branch information
codeodor committed Apr 28, 2016
1 parent 88a6398 commit f0a16f2
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/bh/core_ext/rails/form/base_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def label_and_field_container(label_and_field, field_type, errors = {})
def show_error_icon?(field_type, errors, suffix = nil)
no_icon = %w(checkbox number_field radio_button select legend)
hide = no_icon.include?(field_type.to_s)
errors.any? && @options.fetch(:errors, {}).fetch(:icons, true) && !hide && suffix.nil?
errors.any? && (@options.fetch(:errors) || {}).fetch(:icons, true) && !hide && suffix.nil?
end

def error_icon_tag
Expand Down

0 comments on commit f0a16f2

Please sign in to comment.