Here's an ActiveRecord oddity. If I call WebPageCache.create(:key => [1, 2, 3]), AR appears to store a key of [1,2,3].to_yaml even though I have not specified 'serialize :key'. Is this documented? If not, it feels like a bug: ======== schema: create_table "web_page_caches", :force => true do |t| t.string "key" t.binary "value", :limit => 16777215 t.datetime "expiration" t.datetime "created_at" t.datetime "updated_at" end ======== model: class WebPageCache < ActiveRecord::Base end ======== results:
WebPageCache.create(:key=>[1, 2, 3])
=> #<WebPageCache id: 297, key: [1, 2, 3], value: nil, expiration: nil, created_at: "2010-05-08 03:46:04", updated_at: "2010-05-08 03:46:04">
WebPageCache.count
=> 1
WebPageCache.first
=> #<WebPageCache id: 297, key: "--- \n- 1\n- 2\n- 3\n", value: nil, expiration: nil, created_at: "2010-05-08 03:46:04", updated_at: "2010-05-08 03:46:04"> WebPageCache.serialized_attributes => {}