rails 中模型的组合名称 [英] composed name of models in rails

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

问题描述

我正在使用带有西班牙语的旧数据库的 RoR.我有表格和 registropersona 和模型 RegistroPersona.现在我想运行 rails generate scaffold_controller registro_persona 但是生成的控制器名称应该是RegistrosPersonasController(注意 Registros 和 Personas 中最后的 s).我该怎么做?

解决方案

你可以编辑你的 config/initializers/infletions.rb 文件来支持它,或者只是手动重命名控制器.

I'm working with RoR with a legacy database in spanish language. I have the table and registropersona and model RegistroPersona. Now I want to run rails generate scaffold_controller registro_persona But the generated name of controller should be RegistrosPersonasController (Note the final s in Registros and Personas). How can I do this?

解决方案

You can either edit your config/initializers/infletions.rb file to support that, or just rename the controller manually.

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

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