手动复数 Rails 3 控制器
我有一个非复数的 Rails 3 控制器 (IphoneUser) - 它已经有一些控制器方法,并生成了一个模型。
然而,我希望现在就将其多元化,而不是在游戏进入太晚的时候。 在没有一对一猜测和检查的噩梦的情况下,对该控制器进行复数化的最佳方法是什么?
I have a Rails 3 controller which is not pluralized (IphoneUser) - it already has some controller methods, and a model generated.
However I'd like now rather than when it gets too late into the game, to pluralize it.
What's the best way to pluralize this controller without a nightmare of 1-by-1 guess and checks?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您应该只需要重命名控制器、它的类名称、它的视图文件夹、它的帮助程序和它的功能测试。唯一的其他选择是使用 Rails 生成器来销毁它
rails destroy
然后重新创建它并正确命名。我只需复制控制器方法并将它们粘贴到新文件中。rails destroy
不会影响您的模型。You should just need to rename the controller, it's class name, it's views folder, its helper and its functional tests. The only other option is to use the rails generator to destroy it
rails destroy
and then recreate it named properly. I'd just copy the controller methods and paste them into the new file.rails destroy
won't affect your model.