我正在使用postgres并使用HSTORE
在用户模型中 store_accessor:filter_options,:makes,:cities,:bodies,:detail_types,:engines,:transmission
然后我做了 self.filter_options = new_optionsself.save
=>真
self.filter_options => {" make" =>" [2]"," cities" =>" [1,2,3,4,5, 6,7,8]"," body" =>" [1,2,3,4,5,6,7,8,9,10,11]& #34;,"引擎" =>" [1,2,3,4,5,6]"," detail_types" =>&# 34; [1,2,3,4,5,6,7,8,9,10,11]","传输" =>" [1,2, 3,4,5,6]"}
我们看到它存储正确,但如果我刷新页面或执行 self.reload ,则会回滚
self.reload.filter_options => {" make" =>" [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17 ,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42 ,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67 ,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92 ,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111]","城市&# 34; =>" [1,2,3,4,5,6,7,8]"," body" =>" [1,2 ,3,4,5,6,7,8,9,10,11]","引擎" =>" [1,2,3,4,5, 6]"," detail_types" =>" [1,2,3,4,5,6,7,8,9,10,11]", "传输" =>" [1,2,3,4,5,6]"}
答案 0 :(得分:0)
Rogue after_initialize回调已经入侵了我的模型,问题解决了