我阅读了如何将 Hash 对象添加到 ActiveRecord 类?尝试但迁移失败并遵循那里的格式。
我试过了:
class AddTestResponsesToSurveys < ActiveRecord::Migration
def change
add_column :surveys, :responses, :hash
end
end
当我运行时rake db:migrate
,我的schema.rb
文件中出现一个错误,上面写着:
# Could not dump table "surveys" because of following StandardError
# Unknown type 'hash' for column 'responses'
我究竟做错了什么?