【问题标题】:How to create a many_to_many association and German tablenames如何创建 many_to_many 关联和德语表名
【发布时间】:2016-06-18 12:29:36
【问题描述】:

我使用的是 Sequel 模型,我使用的是德语表名。

在德语中,我们不会在名词上加上“s”来表示复数。我需要定义不带英文复数形式的many_to_many 表名。

/usr/lib/ruby/gems/2.3.0/gems/sqlite3-1.3.11/lib/sqlite3/database.rb:91:in `initialize': SQLite3::SQLException: no such table: platzs_schichts (Sequel::DatabaseError)

如何设置 many_to_many 表名?

【问题讨论】:

  • 随波逐流,让软件随心所欲,而不是与它抗争,这通常更容易。是的,不幸的是,与大多数软件一样,该软件具有英语倾向,但您可能会掉入兔子洞,试图强迫它表现出它想要假设的不同行为。

标签: sql ruby datamapper sequel


【解决方案1】:

您可以尝试使用:join_table 选项指定表名

has_and_belongs_to_many :platz, join_table: :platz_schicht

See the documentation here

【讨论】:

    猜你喜欢
    • 2016-06-02
    • 1970-01-01
    • 1970-01-01
    • 2017-04-29
    • 1970-01-01
    • 1970-01-01
    • 2018-01-25
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多