Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在开发一个应该依赖于现有数据库的 Rails 应用程序。那里有几个表名,它们总是复数,比如“系列”。
应用程序无法与与其关联的模型正常工作。你打算如何处理它 - 有没有不改变命名的解决方案?
提前致谢!
听起来您需要告诉 Rails “系列”是不可数的——也就是说,它不应该尝试将其变形为单数/复数。为此,请将该行添加inflect.uncountable 'series'到您的config/initializers/inflections.rb文件中。
inflect.uncountable 'series'
config/initializers/inflections.rb
然而,奇怪的是,默认情况下“系列”似乎是不可数的。你只是从许多相似的名字中选择它作为例子吗?