用户创建帐户时,必须将当前日期时间发送到数据库。我有一列,例如“ a_started_at”。
控制器:
def create
.......
if @user.save
@current_Time = DateTime.now
@current_Time = current_time.strftime("%Y/%m/%d %H:%M")
end
.......
end
对于用户参数,我在“ company_attributes”中发送了它
company_attributes[a_started_at => @current_Time]
(代表OP张贴)。
我只是users.company.started_at = DateTime.now
在create方法中完成了工作。
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句