我试图生成这样的模型:
rails g scaffold Octopus field1:string, field2:string, ...
这向我抛出了这个错误消息:
[WARNING] The model name 'Octopus' was recognized as a plural, using the singular 'Octopu' instead. Override with --force-plural or setup custom inflection rules for this noun before running the generator.
这给了我octopu
我不想要的单数版本。因此我打开了 inflections.rb 并插入了这个:
ActiveSupport::Inflector.inflections(:en) do |inflect|
inflect.irregular 'octopus', 'octopuses'
end
但现在我明白了:
The name 'Octopus' is either already used in your application or reserved by Ruby on Rails. Please choose an alternative and run this generator again.
知道我做错了什么吗?