我正在尝试使用ActiveUUID
gem 使我的Survey
表的主键成为 UUID。(MySQL)
即使我有:primary_key => true
它仍然MUL
出于某种原因将其设置为?这是预期的吗?
移民:
class CreateSurveys < ActiveRecord::Migration
def change
create_table :surveys, :id => false do |t|
t.references :employee, :null => false
t.uuid :id, :primary_key => true
t.datetime :expired_at
t.timestamps
end
add_index :surveys, :id
end
end
模型:survey.rb
class Survey < ActiveRecord::Base
include ActiveUUID::UUID
belongs_to :employee
validates :employee, :presence => true
end