diff --git a/railties/CHANGELOG.md b/railties/CHANGELOG.md index f26546b5e4..b015554ad1 100644 --- a/railties/CHANGELOG.md +++ b/railties/CHANGELOG.md @@ -1,5 +1,10 @@ ## 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. *Xavier Noria* diff --git a/railties/lib/rails/generators/generated_attribute.rb b/railties/lib/rails/generators/generated_attribute.rb index 6867d029b9..0bea88f511 100644 --- a/railties/lib/rails/generators/generated_attribute.rb +++ b/railties/lib/rails/generators/generated_attribute.rb @@ -106,9 +106,9 @@ module Rails @field_type ||= case type when :integer then :number_field when :float, :decimal then :text_field - when :time then :time_select - when :datetime, :timestamp then :datetime_select - when :date then :date_select + when :time then :time_field + when :datetime, :timestamp then :datetime_field + when :date then :date_field when :text then :text_area when :rich_text then :rich_text_area when :boolean then :check_box diff --git a/railties/test/generators/generated_attribute_test.rb b/railties/test/generators/generated_attribute_test.rb index 895cb74bb9..122d243cba 100644 --- a/railties/test/generators/generated_attribute_test.rb +++ b/railties/test/generators/generated_attribute_test.rb @@ -29,16 +29,16 @@ class GeneratedAttributeTest < Rails::Generators::TestCase def test_field_type_returns_datetime_select %w(datetime timestamp).each do |attribute_type| - assert_field_type attribute_type, :datetime_select + assert_field_type attribute_type, :datetime_field end end def test_field_type_returns_time_select - assert_field_type :time, :time_select + assert_field_type :time, :time_field end def test_field_type_returns_date_select - assert_field_type :date, :date_select + assert_field_type :date, :date_field end def test_field_type_returns_text_area