合併後,我的RoR 3項目不再'正確創建'。默認屬性得到正確設置,而不是那些我在傳:rails 3創建設置值以開票
1.9.3-p125 :020 > f=Ifilter.create(:name => "test2", :regex => "()")
SQL (101.5ms) INSERT INTO "ifilters" ("created_at", "name", "regex", "updated_at") VALUES (?, ?, ?, ?) [["created_at", Sat, 10 Mar 2012 03:36:24 UTC +00:00], ["name", nil], ["regex", nil], ["updated_at", Sat, 10 Mar 2012 03:36:24 UTC +00:00]]
=> #<Ifilter id: 2, name: nil, regex: nil, created_at: "2012-03-10 03:36:24", updated_at: "2012-03-10 03:36:24">
不過,保存仍然有效:
1.9.3-p125 :021 > f=Ifilter.new
=> #<Ifilter id: nil, name: nil, regex: nil, created_at: nil, updated_at: nil>
1.9.3-p125 :022 > f.name = "test"
=> "test"
1.9.3-p125 :023 > f.regex = "()"
=> "()"
1.9.3-p125 :024 > f.save
SQL (4.8ms) INSERT INTO "ifilters" ("created_at", "name", "regex", "updated_at") VALUES (?, ?, ?, ?) [["created_at", Sat, 10 Mar 2012 04:13:10 UTC +00:00], ["name", "test"], ["regex", "()"], ["updated_at", Sat, 10 Mar 2012 04:13:10 UTC +00:00]]
=> true
這是怎麼回事?
謝謝!
您如何定義模型? – 2012-03-10 04:52:13
只是完全標準 - 導軌生成腳手架ifilter名稱:字符串正則表達式:字符串。沒有什麼可以合併到ifilter中,但框架中的東西可能已經更新。 – 2012-03-10 05:39:00