Ruby on rails 生成应用程序记录模型

Ruby on rails 生成应用程序记录模型,ruby-on-rails,Ruby On Rails,从Rails 5.2发行说明中: ApplicationRecord is no longer generated when generating models. If you need to generate it, it can be created with rails g application_record. (Pull Request) 我使用以下语法生成了一个新应用程序: rails new TestApp -d mysql 但是在app/models中创建了一个applica

从Rails 5.2发行说明中:

ApplicationRecord is no longer generated when generating models. If you need to generate it, it can be created with rails g application_record. (Pull Request)
我使用以下语法生成了一个新应用程序:

rails new TestApp -d mysql
但是在app/models中创建了一个application_record.rb文件

rails -v
产生:

Rails 5.2.2

ruby -v
ruby 2.6.0p0 (2018-12-25 revision 66547) [x86_64-darwin18]
产生:

Rails 5.2.2

ruby -v
ruby 2.6.0p0 (2018-12-25 revision 66547) [x86_64-darwin18]
我坐的是Mac Mojave


这是一个bug,还是我误解了发行说明?

我相信您误解了发行说明

创建新应用程序时,将创建
models
目录,并在
models
目录中创建
ApplicationRecord
。但是,你看,你还没有生成任何模型。当您执行rails g model…时,就会发生这种情况


当您(最终)执行rails g model…时,(如发行说明中所述),
ApplicationRecord
将不会生成,因为它是在您创建应用程序时生成的。

我相信您误解了发行说明

创建新应用程序时,将创建
models
目录,并在
models
目录中创建
ApplicationRecord
。但是,你看,你还没有生成任何模型。当您执行rails g model…时,就会发生这种情况


当您(最终)执行rails g model…时,(如发行说明中所述),
ApplicationRecord
将不会生成,因为它是在您创建应用程序时生成的。

显然,文档声明在生成模型时不再生成
ApplicationRecord
。从您的问题可以看出,
ApplicationRecord
是在创建应用程序时生成的,不是吗?如果是这样,那么一切看起来都是一致的,是吗?但模型生成不是新应用程序创建的一部分吗。当您生成一个
新的
应用程序(但尚未完成
rails g model…
)时,除了
应用程序记录
,您在模型目录中看到了哪些模型?啊,好的,我明白您的意思。我还没有任何模型,但我很困惑,因为模型目录已经创建,并且应用程序记录就在其中。显然,文档说明生成模型时不再生成
ApplicationRecord
。从您的问题可以看出,
ApplicationRecord
是在创建应用程序时生成的,不是吗?如果是这样,那么一切看起来都是一致的,是吗?但模型生成不是新应用程序创建的一部分吗。当您生成一个
新的
应用程序(但尚未完成
rails g model…
)时,除了
应用程序记录
,您在模型目录中看到了哪些模型?啊,好的,我明白您的意思。我还没有任何模型,但我很困惑,因为模型目录是创建的,应用程序记录就在其中。