对于 Cequel 记录/模式,名称由rake cequel:migrate
. 但是我们如何在模型定义中分配一个名字呢?
我尝试了以下但没有奏效(Cequel 1.7.0):
class MyInfo
include Cequel::Record
key :name, :text
column :info, :text
self.table_name = "my_info_2" #<<< need to set a custom name
end
对于 Cequel 记录/模式,名称由rake cequel:migrate
. 但是我们如何在模型定义中分配一个名字呢?
我尝试了以下但没有奏效(Cequel 1.7.0):
class MyInfo
include Cequel::Record
key :name, :text
column :info, :text
self.table_name = "my_info_2" #<<< need to set a custom name
end
更新的 cequel 版本 1.9.1 启用了自定义命名。作者也在GitHub/Cequel上证实了这一点:
The self.table_name = ... syntax works for the current version (1.9.1).
A lot of improvements have been made in the 9 months since 1.7.0 was released.
Any chance you could upgrade?