Commit 9e4aa232b2d365181fcc7ac4c368ec6bab30ad96
1 parent
454a6fdb
Exists in
master
and in
29 other branches
Don't crash when the form builder's object is nil
Showing
1 changed file
with
1 additions
and
1 deletions
Show diff stats
app/helpers/application_helper.rb
... | ... | @@ -778,7 +778,7 @@ module ApplicationHelper |
778 | 778 | (field_helpers - %w(hidden_field)).each do |selector| |
779 | 779 | src = <<-END_SRC |
780 | 780 | def #{selector}(field, *args, &proc) |
781 | - text = object.class.human_attribute_name(field.to_s) | |
781 | + text = object.class.respond_to?(:human_attribute_name) && object.class.human_attribute_name(field.to_s) || field.to_s.humanize | |
782 | 782 | NoosferoFormBuilder::output_field(text, super) |
783 | 783 | end |
784 | 784 | END_SRC | ... | ... |