我在Account
下面有一个模型/app/models/account.rb
:
class Account < ActiveRecord::Base
end
当我现在请求控制器时,我得到 undefined method all for Account:Module
:
class AccountsController < ApplicationController
def index
@accounts = Account.all
end
end
我尝试将模型重命名为Accounte
,这确实有效。但是我看到很多使用Account
模型的rails教程,很难找到其他名称。
如何找到并停用帐户模块以清除此命名冲突?
我可以通过Account
访问错误 rails console
。
答案 0 :(得分:1)
问题是我使用rails new account
在Account
中创建了一个模块config/application.rb
。这导致了命名问题。