如何映射非标表的ActiveRecord或者我应该用其他的ORM? [英] how to map non-standard table with ActiveRecord or should I use other ORM?
本文介绍了如何映射非标表的ActiveRecord或者我应该用其他的ORM?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我使用的工具(UltraSms),需要命名的三个表(smsin,smsout和放大器; smsparts)
I'm using a tool(UltraSms) that required three tables named (smsin, smsout & smsparts)
我需要这些表在同一个Rails应用程序,有其他表使用。随着ActiveRecrod我知道,表名必须是复数按照惯例活动记录类的名字。有没有一种方法可以轻松地映射那些到ActiveRecrod类或我应该找到手工的方式做的ORM呢?
I need these tables to be used in the same Rails application that has other tables. With ActiveRecrod I know that table names has to be plural of the Active record class name by convention. Is there a way to map those to an ActiveRecrod class easily or should I find manual way to do ORM for it?
谢谢
潭
推荐答案
你可以这样做:
class MyClass < ActiveRecord::Base
set_table_name "smsin"
end
这篇关于如何映射非标表的ActiveRecord或者我应该用其他的ORM?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文