Ruby on Rails 复数模型名称 [英] Ruby on Rails Plural Model Name

查看:48
本文介绍了Ruby on Rails 复数模型名称的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个代表飞行规则的域模型.飞行规则是执行飞行的一系列规定.目视飞行规则或 VFR 就是这样一个例子.我正在尝试构建这个模型,但 Rails 坚持将 FlightRules 设为单数 (FlightRule),而我需要它保持复数.有没有办法让 Rails 保持模型名称的复数?

I have a domain model that represents flight rules. Flight rules are a collection of regulations under which a flight is performed. Visual Flight Rules, or VFR is one such example. I am trying to scaffold this model, but Rails insists on making FlightRules singular (FlightRule), while I need it to remain plural. Is there any way of having Rails keep the model name plural?

推荐答案

试试这个

rails generate scaffold FlightRules (...) --force-plural

您可以通过以下方式获得有关生成器的帮助:

You can get the help on the generator with:

rails g scaffold -h

这篇关于Ruby on Rails 复数模型名称的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆