保存記錄在我的rails 3項目中,我使用DataMapper作爲ORM,Haml作爲模板語言。並定義了兩個模型Car和Image之間的一對多關聯。一輛車可以有很多圖像,一張圖像屬於一輛車。無法使用部分
在我的圖像模型,我有以下
belongs to: car
在我的車模型,我有
has n, :images
在爲汽車模型我有以下看法:
= f.fields_for :images, @car.images do |img|
= render :partial => "cars/images", :locals => {:f => img}
現在,在圖像模型的視圖中,我有
= time_select("image", "upload_time")
其中upload_time是圖像表中的字段。
但是數據沒有記錄在圖像表中。訪問部分字段的正確方法是什麼?
謝謝
做單元測試,說些什麼呢? – Phlip