Rails rails Model self.table_name 问题

76521 · June 24, 2014 · 2165 hits

class Account < ActiveRecord::Base self.table_name = "socials" end 我有一个 account 类,然后引用了 socials 表,数据库中已经把 accounts 表删除了,查询、更新、删除的时候是正常的,但是创建的时候报错 ActiveRecord::StatementInvalid: Mysql2::Error: Table 'pscrmdata.accounts' doesn't exist: INSERT INTO socials (`account_name) VALUES ( '新浪微博')。

No Reply at the moment.
You need to Sign in before reply, if you don't have an account, please Sign up first.