如何在Cequel中自定义表名?

时间:2016-06-21 02:35:40

标签: ruby-on-rails cequel

对于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

1 个答案:

答案 0 :(得分:0)

更新的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?