可以使用strftime实现这一目标。
代码:
<input class='dob' name='user[dob]' type="text" value='<%= user.dob.strftime("%m/%d/%Y") %>'/>
,其只对编辑工作。但新的它会显示错误未定义的方法strftime为零类 – 2014-08-28 12:45:44
[使用三元运算符来处理这种情况!](http://*.com/questions/19999757/ternary-operator-within-rails-view) – 2014-08-28 12:47:47
,其只对编辑工作。但新的它会显示错误未定义的方法strftime为零类 – 2014-08-28 12:45:44
[使用三元运算符来处理这种情况!](http://*.com/questions/19999757/ternary-operator-within-rails-view) – 2014-08-28 12:47:47