Rails Rails' polymorphic 使用 integer type

andywang · 2015年06月04日 · 最后由 huobazi 回复于 2015年06月04日 · 1737 次阅读

Rails' polymorphic associations 是很好的一个特性,但是 _type 支持 varchar 类型的,浪费空间,如果使用 integer 类型会节约不少。

https://github.com/doliveirakn/polymorphic_integer_type 推荐 建议 rails 可以引用此特性,就不需要这样 hack 了

这哥们还搞了个 STI 版本的

https://github.com/doliveirakn/inheritance_integer_type

可我觉得这浪费不了多少空间啊

需要 登录 后方可回复, 如果你还没有账号请 注册新账号