Ruby on rails 我想在为客户输入信息时添加出生日期
嗨,我在使用ruby on rails,当我输入2007年到2012年的出生日期时, 我的数据库中有这个命令,我用粗体显示了一个错误,问题是我需要所有的选项来选择出生日期,当然也要在将来选择它们Ruby on rails 我想在为客户输入信息时添加出生日期,ruby-on-rails,date,Ruby On Rails,Date,嗨,我在使用ruby on rails,当我输入2007年到2012年的出生日期时, 我的数据库中有这个命令,我用粗体显示了一个错误,问题是我需要所有的选项来选择出生日期,当然也要在将来选择它们 class CreatePacientes < ActiveRecord::Migration def change create_table :pacientes do |t| t.string :cedula t.string :nombre t
class CreatePacientes < ActiveRecord::Migration
def change
create_table :pacientes do |t|
t.string :cedula
t.string :nombre
t.string :apellido1
t.string :apellido2
**t.date :fecha_nacimiento**
t.string :genero
t.string :estado_civil
t.string :provincia
t.string :canton
t.string :distrito
t.text :otras_senas
t.string :telefono_casa
t.string :telefono_celular
t.string :correo_electronico
t.string :nacionalidad
t.integer :anos_estudio
t.string :profesion
t.string :ocupacion
t.timestamps
end
end
end
class CreatePacientes
如果查看,您将看到它接受以下两个选项:
:start_year - Set the start year for the year select. Default is Time.now.year - 5.
:end_year - Set the end year for the year select. Default is Time.now.year + 5.
您看到的是默认值。虽然我不知道为什么你的最大寿命是2012年,而不是2017年,因为它应该是+/-5年。无论如何,试着通过限制来获得你需要的范围。或者,如果需要输入任何年份,请不要使用
date\u select
。您的问题可能不是表列,而是视图或所使用的视图辅助对象。你能粘贴你的表单代码吗?我试着粘贴,但我还不能发布代码!很抱歉,我的声誉不足8个小时,所以我需要等待8个小时-我将尝试在评论中发布它这是我的_form.html.erb的一部分