'method_missing': (NoMethodError) 的未定义方法“active_storage”

'method_missing': undefined method `active_storage' for (NoMethodError)

我目前在 Rails 5.2 应用程序上生成了一个 Ruby。当我 运行 rails active_storage:install 它创建了一个 20180915211415_create_active_storage_tables 迁移。但是,当我尝试启动服务器时 运行 出现以下错误。

/Users/stevenaguilar/.rvm/gems/ruby-2.2.2/gems/railties-5.2.1/lib/rails/railtie/configuration.rb:97:in `method_missing': undefined method `active_storage' for
#<Rails::Application::Configuration:0x007f80bbbf1c18> (NoMethodError)

这是我的 gemfile:

source 'https://rubygems.org'

git_source(:github) do |repo_name|   repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include?("/")   "https://github.com/#{repo_name}.git" end


# Bundle edge Rails instead: gem 'rails', github: 'rails/rails' gem 'rails', '~> 5.2'
# Use postgresql as the database for Active Record gem 'pg', '>= 0.18', '< 2.0'
# Use Puma as the app server gem 'puma', '~> 3.7'
# Transpile app-like JavaScript. Read more: https://github.com/rails/webpacker gem 'webpacker'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder gem 'jbuilder', '~> 2.5'

gem 'activestorage', '~> 5.2', '>= 5.2.1'
# Authentication gem 'devise'

gem 'bootsnap'
# Use ActiveModel has_secure_password
# gem 'bcrypt', '~> 3.1.7'

# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development

group :development, :test do   # Call 'byebug' anywhere in the code to stop execution and get a debugger console   gem 'byebug', platforms: [:mri, :mingw, :x64_mingw]   # Adds support for Capybara system testing and selenium driver   gem 'capybara', '~> 2.13'   gem 'selenium-webdriver' end

group :development do   # Access an IRB console on exception pages or by using <%= console %> anywhere in the code.   gem 'web-console', '>=
3.3.0'   gem 'listen', '>= 3.0.5', '< 3.2'   # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring   gem 'spring'   gem 'spring-watcher-listen', '~> 2.0.0' end

# Windows does not include zoneinfo files, so bundle the tzinfo-data gem gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]

在 application.rb 文件中:

require_relative 'boot'

require "rails"
# Pick the frameworks you want:
require "active_model/railtie"
require "active_job/railtie"
require "active_record/railtie"
require "action_controller/railtie"
require "action_mailer/railtie"
require "action_view/railtie"
# require "action_cable/engine"
# require "sprockets/railtie"
require "rails/test_unit/railtie"

# Require the gems listed in Gemfile, including any gems
# you've limited to :test, :development, or :production.
Bundler.require(*Rails.groups)

module ArtsySpace
  class Application < Rails::Application
    # Initialize configuration defaults for originally generated Rails version.
    config.load_defaults 5.1

    # Settings in config/environments/* take precedence over those specified here.
    # Application configuration should go into files in config/initializers
    # -- all .rb files in that directory are automatically loaded.
  end
end

我按照以下article中的安装说明进行了安装: 但是,这给我带来了问题,所以我决定删除该应用程序并从头开始。 rails _5.2.1_ new vuejs-ror-setup -M -C -S --skip-turbolinks --webpack=vue -d postgresql

通过以下方式。不确定是什么导致了这个错误?

您需要使用其他框架加载 Active Storage:

# config/application.rb
require "active_storage/engine"