简体   繁体   English

Rails中使用datetime的strong_parameters

[英]strong_parameters in Rails using datetime

I'm using strong_parameters to create a nested object in a form . 我正在使用strong_parametersform创建嵌套对象。 All attributes works properly, except datetime parameters. datetime参数外,所有属性均正常工作。

There is something special in nested datetime parameters? 嵌套的datetime参数有什么特别的吗?

looking at the console, the parameters are properly nested, but it comes with a special Ni , with N from 1 to 6 depending on the especification of day, month, year... but when it creates the object ( INSERT INTO ), the specified parameter datetime doesn't appears: 在控制台上,参数已正确嵌套,但带有一个特殊的Ni ,根据日期,月份,年的指定, N介于1到6之间。但是当它创建对象( INSERT INTO )时,指定的参数datetime不会出现:

Processing by ReleasesController#create as HTML
Parameters: {"utf8"=>"✓", ... "release"=>{ ... "qm_attributes"=>{"user_id"=>"1", "start_at(1i)"=>"2014", "start_at(2i)"=>"3", "start_at(3i)"=>"31", "start_at(4i)"=>"14", "start_at(5i)"=>"57", "end_at(1i)"=>"2014", "end_at(2i)"=>"3", "end_at(3i)"=>"31", "end_at(4i)"=>"14", "end_at(5i)"=>"57", ... }}, "commit"=>"Create Release"}

SQL (0.3ms)  INSERT INTO "qms" ("created_at", "release_id", "tipo_qm_release", "updated_at", "user_id") VALUES (?, ?, ?, ?, ?)

如果您将部分代码放在这里,以使您的问题更清楚,那会是什么样子呢?看起来像是与.permit()有关的东西

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM