2016-02-27 59 views
0

我想序列化一個表,所以我可以保存並從中檢索哈希。Rails-試圖序列化數據庫表,但得到未定義的方法`序列化'錯誤

頁面模型

class CreatePages < ActiveRecord::Migration 

    def change 
    create_table :pages do |t| 

     t.timestamps null: false 
     t.text :title 
     t.text :content_top 
     t.text :content_bottom 
     t.text :table_head 
     t.text :table_content 
     t.timestamps null: false 
    end 
    serialize :table_head 
    serialize :table_content 
    end 
end 

當我運行數據庫遷移我收到以下錯誤NoMethodError: undefined method 'serialize' for #<ActiveRecord::Migration:0x007fd31c11f318>

不知道什麼是錯在這裏。

回答