diff --git a/README.rdoc b/README.rdoc index 73f8d618..0c302634 100644 --- a/README.rdoc +++ b/README.rdoc @@ -382,6 +382,11 @@ SimpleForm uses all power of I18n API to lookup labels, hints and placeholders. user: username: 'Your username' password: '****' + options: + user: + gender: + male: 'Male' + female: "Female' And your forms will use this information to render the components for you. @@ -410,6 +415,10 @@ This way SimpleForm will figure out the right translation for you, based on the placeholders: username: 'Your username' password: '****' + options: + gender: + male: 'Male' + female: "Female' SimpleForm will always look for a default attribute translation if no specific is found inside the model key. In addition, SimpleForm will fallback to default human_attribute_name from Rails when no other translation is found for labels. diff --git a/lib/simple_form/inputs/collection_input.rb b/lib/simple_form/inputs/collection_input.rb index d89af303..b6ce73a3 100644 --- a/lib/simple_form/inputs/collection_input.rb +++ b/lib/simple_form/inputs/collection_input.rb @@ -55,18 +55,16 @@ module SimpleForm value ||= common_method_for[:value] end - if SimpleForm.translate && [label, value] == [:to_s, :to_s] - translate_collection - [:first, :last] - else - [label, value] - end + [label, value] end def detect_common_display_methods collection_classes = detect_collection_classes - if collection_classes.include?(Array) + if SimpleForm.translate && collection_classes == [Symbol] + translate_collection + { :label => :first, :value => :last } + elsif collection_classes.include?(Array) { :label => :first, :value => :last } elsif collection_includes_basic_objects?(collection_classes) { :label => :to_s, :value => :to_s }