英文:
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.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论