mirror of
https://github.com/heartcombo/simple_form.git
synced 2022-11-09 12:19:26 -05:00
Integer is equals to numeric.
This commit is contained in:
parent
e65f3280ca
commit
f6ce729f5e
4 changed files with 3 additions and 5 deletions
|
@ -43,7 +43,7 @@ module SimpleForm
|
|||
column = @object.column_for_attribute(@attribute)
|
||||
input_type = column.type
|
||||
case input_type
|
||||
when :decimal then :numeric
|
||||
when :decimal, :integer then :numeric
|
||||
when :timestamp then :datetime
|
||||
when nil, :string then
|
||||
@attribute.to_s =~ /password/ ? :password : :string
|
||||
|
|
|
@ -12,8 +12,6 @@ module SimpleForm
|
|||
:hidden => Mapping.new(:hidden_field, false, false),
|
||||
:select => Mapping.new(:collection_select, true, true),
|
||||
:radio => Mapping.new(:collection_radio, true, false),
|
||||
# Do we need integer and numeric?
|
||||
:integer => Mapping.new(:text_field, false, false),
|
||||
:numeric => Mapping.new(:text_field, false, false),
|
||||
:string => Mapping.new(:text_field, false, false)
|
||||
}
|
||||
|
|
|
@ -42,7 +42,7 @@ class InputTest < ActionView::TestCase
|
|||
simple_form_for @user do |f|
|
||||
concat f.input :age
|
||||
end
|
||||
assert_select 'form input.integer#user_age'
|
||||
assert_select 'form input.numeric#user_age'
|
||||
end
|
||||
|
||||
test 'input should generate a text field by default for decimal attributes' do
|
||||
|
|
|
@ -73,7 +73,7 @@ class LabelTest < ActionView::TestCase
|
|||
assert_select 'form label.datetime[for=user_created_at]'
|
||||
assert_select 'form label.date[for=user_born_at]'
|
||||
assert_select 'form label.boolean[for=user_active]'
|
||||
assert_select 'form label.integer[for=user_age]'
|
||||
assert_select 'form label.numeric[for=user_age]'
|
||||
assert_select 'form label.numeric[for=user_credit_limit]'
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue