![](/img/trans.png)
[英]RoR undefined method 'to_datetime' depending on order of helper methods
[英]RoR scaffold error, 'undefined method to_datetime for 0:Fixnum'
我是 RoR 的新手,然后用日期时间类型搭建一个表,当我输入生成的“新”页面表单时出现以下错误:
0:Fixnum 的未定义方法`to_datetime'
<%= form_for(@alumno) do |f| %>
<% if @alumno.errors.any? %>
<div id="error_explanation">
<h2><%= pluralize(@alumno.errors.count, "error") %> prohibited this alumno from being saved:</h2>
<ul>
<% @alumno.errors.full_messages.each do |msg| %>
<li><%= msg %></li>
<% end %>
</ul>
</div>
<% end %>
<div class="field">
<%= f.label :nombres %><br>
<%= f.text_field :nombres %>
</div>
<div class="field">
<%= f.label :apellido_paterno %><br>
<%= f.text_field :apellido_paterno %>
</div>
<div class="field">
<%= f.label :apellido_materno %><br>
<%= f.text_field :apellido_materno %>
</div>
<div class="field">
<%= f.label :dni %><br>
<%= f.text_field :dni %>
</div>
<div class="field">
<%= f.label :usuario %><br>
<%= f.text_field :usuario %>
</div>
<div class="field">
<%= f.label :usuario_personal %><br>
<%= f.text_field :usuario_personal %>
</div>
<div class="field">
<%= f.label :pass %><br>
<%= f.text_area :pass %>
</div>
<div class="field">
<%= f.label :fecha_registro %><br>
<%= f.datetime_select :fecha_registro %> /*error happens here*/
</div>
<div class="field">
<%= f.label :fecha_modificacion %><br>
<%= f.datetime_select :fecha_modificacion %>
</div>
<div class="actions">
<%= f.submit %>
</div>
我发现了类似的问题,但不知道如何修复该问题。 RoR 版本 4.0.0
红宝石版本 2.3.1p112
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.