提交 a314879a 编写于 作者: Y yui-knk

[ci skip] Fix which method `FormHelper#date_field` try to call

When this method was implemented
(https://github.com/rails/rails/pull/5016/files), `to_date` is called.
But this behavior was chagned refactoring
(https://github.com/rails/rails/pull/6452/files).
In the first commit, there were not test which asserts `to_date` is called.

I think trying `to_date` is more useful than trying `strftime`, because
we can write `"2015-01-01".to_date`. But first fix comments to match
actual behavior.
上级 8c879b7a
......@@ -1038,7 +1038,7 @@ def telephone_field(object_name, method, options = {})
# date_field("user", "born_on")
# # => <input id="user_born_on" name="user[born_on]" type="date" />
#
# The default value is generated by trying to call "to_date"
# The default value is generated by trying to call +strftime+ with "%Y-%m-%d"
# on the object's value, which makes it behave as expected for instances
# of DateTime and ActiveSupport::TimeWithZone. You can still override that
# by passing the "value" option explicitly, e.g.
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册