diff --git a/app/helpers/admin/enterprises_helper.rb b/app/helpers/admin/enterprises_helper.rb index 516caa9e1c..dc56e675ee 100644 --- a/app/helpers/admin/enterprises_helper.rb +++ b/app/helpers/admin/enterprises_helper.rb @@ -9,5 +9,9 @@ module Admin {} end end + + def select_only_item(size) + size == 1 ? 1 : nil + end end end diff --git a/app/views/spree/admin/products/new.html.haml b/app/views/spree/admin/products/new.html.haml index b2dfe36d49..523da01059 100644 --- a/app/views/spree/admin/products/new.html.haml +++ b/app/views/spree/admin/products/new.html.haml @@ -11,7 +11,7 @@ = f.field_container :supplier do = f.label :supplier_id, t(".supplier") %span.required * - = f.collection_select(:supplier_id, @producers, :id, :name, {:include_blank => true}, {:class => "select2 fullwidth"}) + = f.collection_select(:supplier_id, @producers, :id, :name, {:include_blank => true, :selected => select_only_item(@producers.size)}, {:class => "select2 fullwidth"}) = f.error_message_on :supplier .eight.columns.omega = f.field_container :name do