logo
  • 教程列表
  • SO官方文档
  • 单表继承
    • 基本的例子
    • 自定义继承列
    • Rails 模型具有类型列且没有 STI
  1. StackOverflow 文档
  2. Ruby on Rails 教程
  3. 单表继承
  4. Rails 模型具有类型列且没有 STI

Rails 模型具有类型列且没有 STI

Created: November-22, 2018

在没有调用 STI 的情况下在 Rails 模型中使用 type 列可以通过将:_type_disabled 分配给 inheritance_column 来实现:

class User < ActiveRecord::Base
  self.inheritance_column = :_type_disabled
end
  • 自定义继承列

Copyright © 2018. All right reserved

tastones.com 备案号:鲁ICP备18045372号-1

  • 关于我们
  • 免责声明