Ensure uuid fields are generated with type=text
This commit is contained in:
parent
88e96db1d7
commit
5943e07fc4
|
@ -1,3 +1,6 @@
|
||||||
|
### bug fix
|
||||||
|
* Fix `uuid` input to generate proper input[type=text].
|
||||||
|
|
||||||
## 3.1.0.rc2
|
## 3.1.0.rc2
|
||||||
|
|
||||||
### enhancements
|
### enhancements
|
||||||
|
|
|
@ -6,7 +6,7 @@ module SimpleForm
|
||||||
def input(wrapper_options = nil)
|
def input(wrapper_options = nil)
|
||||||
unless string?
|
unless string?
|
||||||
input_html_classes.unshift("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
|
end
|
||||||
|
|
||||||
merged_input_options = merge_wrapper_options(input_html_options, wrapper_options)
|
merged_input_options = merge_wrapper_options(input_html_options, wrapper_options)
|
||||||
|
@ -16,6 +16,10 @@ module SimpleForm
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
|
def postgresql_type?
|
||||||
|
input_type == :uuid
|
||||||
|
end
|
||||||
|
|
||||||
def string?
|
def string?
|
||||||
input_type == :string
|
input_type == :string
|
||||||
end
|
end
|
||||||
|
|
|
@ -126,9 +126,9 @@ class FormBuilderTest < ActionView::TestCase
|
||||||
assert_select 'form input#user_credit_limit.numeric.decimal'
|
assert_select 'form input#user_credit_limit.numeric.decimal'
|
||||||
end
|
end
|
||||||
|
|
||||||
test 'builder generates uuid fields for uuid columns' do
|
test 'builder generates text fields for uuid columns' do
|
||||||
with_form_for @user, :uuid
|
with_form_for @user, :uuid
|
||||||
assert_select 'form input#user_uuid.string.uuid'
|
assert_select 'form input[type=text]#user_uuid.string.uuid'
|
||||||
end
|
end
|
||||||
|
|
||||||
test 'builder generates password fields for columns that matches password' do
|
test 'builder generates password fields for columns that matches password' do
|
||||||
|
|
Loading…
Reference in New Issue