我正在开发一个 ruby on rails 3.2 应用程序,我需要验证一个具有嵌套属性的表单。在我的模型中,我有这个
班员 attr_accessible :email, :password ......等 has_many :purchase_informations, :dependent => :destroy Accept_nested_attributes_for :purchase_informations, :allow_destroy => true 结尾 类采购信息 属于_to:成员 attr_accessor :same_billing 结尾
以下是表单数据:
{ members:
{ purchase_informations_attributes:
{ 0:
{ information_type: "billing",
title: "Mr",
first_name: "",
last_name: "",
cuhk_no: "",
organization: "",
address: "",
zip_code: "",
country: "Hong Kong",
telephone: "",
mobile: "", fax: "",
email: "asdasdasda", id: "27"
},
1:
{ information_type: "shipping",
title: "Mr",
first_name: "",
last_name: "",
cuhk_no: "",
organization: "",
address: "",
zip_code: "",
country: "Hong Kong",
telephone: "",
mobile: "",
fax: "",
email: "",
id: "28"
}
}
}
}
请帮我验证属性是否为空白。
谢谢!