带 Rails 的多表继承 3
Rails 3 中的多表继承是否有标准或最佳实践?到目前为止,我能找到的最好的文章是:
http://mediumexposure.com/multiple- table-inheritance-active-record/
但即使如此也需要一些更改(例如将需求移至初始值设定项而不是旧的 /config/environment.rb)
有更好的资源/标准吗?
Are there standards or best practices yet when it comes to multi table inheritance in rails 3? So far the best article I could find was:
http://mediumexposure.com/multiple-table-inheritance-active-record/
But even that needed some changes(e.g. moving the requires to an initializer instead of the old /config/environment.rb)
Any better resources / standards?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
对于进行多表继承的简单方法,请查看“acts_as_relation”插件 https://github.com/hzamani /acts_as_relation。
For an easy way to do multi-table inheritance take a look at 'acts_as_relation' plugin https://github.com/hzamani/acts_as_relation.
我最近 fork 了一个很有前途的 gem 来在 Rails 中实现多表继承和类继承。我花了几天时间对其进行快速开发、修复、评论和文档,并将其重新发布为 CITIER(Rails 的类继承和表继承嵌入)。
考虑看一下: https://github.com/PeterHamilton/citier
它实际上需要一些概念从你提到的那篇文章中。
I recently forked a promising gem to implement multiple table inheritance and class inheritance in Rails. I have spent a few days subjecting it to rapid development, fixes, commenting and documentation and have re-released it as CITIER (Class Inheritance and Table Inheritance Embeddings for Rails).
Consider giving it a look: https://github.com/PeterHamilton/citier
It actually takes some concepts from that article you mention.
我参加的 Melbourne Ruby 小组中有一个人写了几篇关于 Rails 中表继承的博客,其中的评论也非常有帮助。它不是专门针对 Rails 3 的,但其中肯定有一些不错的指南。
http://rhnh.net/2010/08/15 /class-table-inheritance-and-eager-loading
http://rhnh.net/2010/07/02/3-reasons-why-you-should-not-use-single-table-inheritance
快乐阅读
There's a guy in the Melbourne Ruby group I attend that's written a couple of blogs on table inheritance in rails and the comments are really helpful as well. It's not specifically Rails 3 but there's definitely some decent pointers in there.
http://rhnh.net/2010/08/15/class-table-inheritance-and-eager-loading
http://rhnh.net/2010/07/02/3-reasons-why-you-should-not-use-single-table-inheritance
happy reading