gpt4 book ai didi

ruby-on-rails - rails 生成模型 Investor - 收到错误 "The name ' Investor' 要么已经使用...”

转载 作者:行者123 更新时间:2023-12-03 22:33:16 25 4
gpt4 key购买 nike

我在这里有一个几乎全新的 ROR 3.1 设置,并且已经生成了 2 个模型(AdminUser 和 Advisor),当我尝试添加另一个模型“Investor”时,出现此错误:

"The name 'Investor' is either already used in your application or reserved by Ruby on Rails. Please choose an alternative and run this generator again."



我正在使用命令: rails g模型投资者 .
我现在的项目中只有两个模型,没有一个被称为投资者......

固定:
原来我的申请叫“Investor”;当我创建 rails 应用程序时,我做了:rails 新投资者。我不得不将我的应用程序名称的所有出现重命名为不同的名称,现在它可以工作了。

以下是您必须更改的文件列表:
  • config.ru
  • Rakefile
  • 配置/应用程序.rb
  • 配置/环境.rb
  • 配置/环境/development.rb
  • 配置/环境/test.rb
  • config/routes.rb
  • 配置/初始化程序/secret_token.rb
  • 配置/初始化程序/session_store.rb
  • 最佳答案

    发生这种情况是因为我的应用程序被称为“投资者”(与我想添加的模型相同),一旦我更改了应用程序名称,它就开始工作......

    关于ruby-on-rails - rails 生成模型 Investor - 收到错误 "The name ' Investor' 要么已经使用...”,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8060443/

    25 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com