开发者

Rails: Empty fields are creating the string 'undefined' in database

开发者 https://www.devze.com 2023-03-18 19:25 出处:网络
For some reason when users are skipping optional fields signing up, the database is filled with the string \'undefined\' instead of NULL or a blank string.

For some reason when users are skipping optional fields signing up, the database is filled with the string 'undefined' instead of NULL or a blank string.

I am using Rails 2.3.4 and MySQL.

Is this a known bug/issue for earlier versions of Rails?

Thank yo开发者_如何学Cu,

Eric


Add a :default option in the field of your schema to what you want

:default => null

or

:default => ""

Will work.

0

精彩评论

暂无评论...
验证码 换一张
取 消