繁体   English   中英

Rails生成模型不使用变形规则

[英]Rails Generate Model not using inflection rule

我正在尝试在Rails 5.1中以及运行时生成“状态”模型

rails generate model status

我懂了

The model name 's' was recognized as a plural, using the singular '' instead. Override with --force-plural or setup custom inflection rules for this noun before running the generator.

然后,我在config / initializers / inflections.rb中添加了一条新规则

ActiveSupport::Inflector.inflections(:en) do |inflect|
  inflect.irregular 'status', 'statuses'
end

再次运行命令,我仍然收到错误。

我想念什么?

也许您可以将名称更改为州,所以复数为州

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM