mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
When generating form partials, use correct fields for date, time and datetime, timestamp.
This commit is contained in:
parent
ab3c1c6e5e
commit
a64dd2ae1d
3 changed files with 11 additions and 6 deletions
|
@ -1,5 +1,10 @@
|
||||||
## Unreleased
|
## Unreleased
|
||||||
|
|
||||||
|
* Scaffolds now use date_field, time_field and datetime_field instead of
|
||||||
|
date_select, time_select and datetime_select; thus providing native date/time pickers.
|
||||||
|
|
||||||
|
*Martijn Lafeber*
|
||||||
|
|
||||||
* Fix a regression in which autoload paths were initialized too late.
|
* Fix a regression in which autoload paths were initialized too late.
|
||||||
|
|
||||||
*Xavier Noria*
|
*Xavier Noria*
|
||||||
|
|
|
@ -106,9 +106,9 @@ module Rails
|
||||||
@field_type ||= case type
|
@field_type ||= case type
|
||||||
when :integer then :number_field
|
when :integer then :number_field
|
||||||
when :float, :decimal then :text_field
|
when :float, :decimal then :text_field
|
||||||
when :time then :time_select
|
when :time then :time_field
|
||||||
when :datetime, :timestamp then :datetime_select
|
when :datetime, :timestamp then :datetime_field
|
||||||
when :date then :date_select
|
when :date then :date_field
|
||||||
when :text then :text_area
|
when :text then :text_area
|
||||||
when :rich_text then :rich_text_area
|
when :rich_text then :rich_text_area
|
||||||
when :boolean then :check_box
|
when :boolean then :check_box
|
||||||
|
|
|
@ -29,16 +29,16 @@ class GeneratedAttributeTest < Rails::Generators::TestCase
|
||||||
|
|
||||||
def test_field_type_returns_datetime_select
|
def test_field_type_returns_datetime_select
|
||||||
%w(datetime timestamp).each do |attribute_type|
|
%w(datetime timestamp).each do |attribute_type|
|
||||||
assert_field_type attribute_type, :datetime_select
|
assert_field_type attribute_type, :datetime_field
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_field_type_returns_time_select
|
def test_field_type_returns_time_select
|
||||||
assert_field_type :time, :time_select
|
assert_field_type :time, :time_field
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_field_type_returns_date_select
|
def test_field_type_returns_date_select
|
||||||
assert_field_type :date, :date_select
|
assert_field_type :date, :date_field
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_field_type_returns_text_area
|
def test_field_type_returns_text_area
|
||||||
|
|
Loading…
Reference in a new issue