diff --git a/CHANGELOG.md b/CHANGELOG.md index 6ebfbb97..adc4dc52 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +### bug fix + * Fix `uuid` input to generate proper input[type=text]. + ## 3.1.0.rc2 ### enhancements diff --git a/lib/simple_form/inputs/string_input.rb b/lib/simple_form/inputs/string_input.rb index 4752be92..efffecc7 100644 --- a/lib/simple_form/inputs/string_input.rb +++ b/lib/simple_form/inputs/string_input.rb @@ -6,7 +6,7 @@ module SimpleForm def input(wrapper_options = nil) unless string? input_html_classes.unshift("string") - input_html_options[:type] ||= input_type if html5? + input_html_options[:type] ||= input_type if html5? && !postgresql_type? end merged_input_options = merge_wrapper_options(input_html_options, wrapper_options) @@ -16,6 +16,10 @@ module SimpleForm private + def postgresql_type? + input_type == :uuid + end + def string? input_type == :string end diff --git a/test/form_builder/general_test.rb b/test/form_builder/general_test.rb index 7022ebeb..2767b196 100644 --- a/test/form_builder/general_test.rb +++ b/test/form_builder/general_test.rb @@ -126,9 +126,9 @@ class FormBuilderTest < ActionView::TestCase assert_select 'form input#user_credit_limit.numeric.decimal' end - test 'builder generates uuid fields for uuid columns' do + test 'builder generates text fields for uuid columns' do with_form_for @user, :uuid - assert_select 'form input#user_uuid.string.uuid' + assert_select 'form input[type=text]#user_uuid.string.uuid' end test 'builder generates password fields for columns that matches password' do