首页 > 解决方案 > Rails activestorage 不会创建迁移文件

问题描述

我使用 Rails 中内置的 activestorage gem 为用户配置文件上传图像,但它不起作用,有趣的是没有错误,只是没有创建迁移。

这里有什么问题,关于如何解决这个问题的任何想法?

导轨版本 - 6.0

我已经添加require 'active_storage/engine'config/application.rb文件中然后运行rails active_storage:install

更有趣的是,我在没有添加require active_storage/engine到 application.rb 的情况下得到了相同的输出。并且没有错误

输出

** Invoke active_storage:install (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute active_storage:install
** Invoke active_storage:install:migrations (first_time)
** Execute active_storage:install:migrations
** Invoke railties:install:migrations (first_time)
** Invoke db:load_config (first_time)
** Invoke environment 
** Execute db:load_config
** Execute railties:install:migrations```

I expect the migration file to be created after this but it is not. 

标签: ruby-on-railsrubyrails-activestorageimage-uploadruby-on-rails-6

解决方案


推荐阅读