不知道如何构建任务 ‘active_storage:install’ (–no-skip-active-storage)。

huangapple go评论62阅读模式
英文:

Don't know how to build task 'active_storage:install' (--no-skip-active-storage)

问题

I am using Rails 7.0.4.3, and I have a really hard time trying to understand why the following is working successfully ...

$ rails new testapp
$ cd testapp
$ bin/rails active_storage:install
Copied migration 20230522144343_create_active_storage_tables.active_storage.rb from active_storage

... but NOT the following?

$ rails new testapp --minimal --no-skip-active-storage
$ cd testapp
$ bin/rails active_storage:install
rails aborted!
Don't know how to build task 'active_storage:install' (See the list of available tasks with rails --tasks)

Did I miss something with the --no-skip-active-storage option?

Thanks,

英文:

I am using Rails 7.0.4.3, and I have a really hard time trying to understand why the following is working successfully ...

$ rails new testapp
$ cd testapp
$ bin/rails active_storage:install
Copied migration 20230522144343_create_active_storage_tables.active_storage.rb from active_storage

... but NOT the following?

$ rails new testapp --minimal --no-skip-active-storage
$ cd testapp
$ bin/rails active_storage:install
rails aborted!
Don't know how to build task 'active_storage:install' (See the list of available tasks with `rails --tasks`)

Did I miss something with the --no-skip-active-storage option?

Thanks,

答案1

得分: 2

Go to config/application.rb

现在取消注释 #require "active_storage/engine

然后再运行:

$ bin/rails active_storage:install

英文:

Go to config/application.rb

Now uncomment #require "active_storage/engine

Then, run again:

$ bin/rails active_storage:install

答案2

得分: 0

我尝试过 --no-skip-active-storage 但没有任何区别。另外,在Rails的最新版本(6.0及以上),Active Storage已预装并可直接使用。

要启用Active Storage功能,只需取消注释 config/application.rb 文件中的 require "active_storage/engine" 这一行。 默认情况下,此行已存在并已注释掉。

-skip-active-storage 起作用,它会跳过所有与 active_storage 相关的文件和配置,但在文档中找不到 --no-skip-active-storage 选项。 默认情况下,--no-skip-active-storage 已启用,因此即使您添加它也不会产生影响。

英文:

I tried the --no-skip-active-storage and it makes no difference, Additianally,In the latest versions of Rails (6.0 and above), Active Storage comes preinstalled and ready to use out of the box.

To enable Active Storage functionality, simply uncomment the line require "active_storage/engine" in the config/application.rb file. This line is already present and commented out by default.

-skip-active-storage workes, it skips all the files and configratoins for active_storage, but cannot find the --no-skip-active-storage option in documentation. By default the --no-skip-active-storage is enabled, so it will have no effect, enen if you add it.

huangapple
  • 本文由 发表于 2023年5月22日 19:54:16
  • 转载请务必保留本文链接:https://go.coder-hub.com/76305910.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定