简体   繁体   English

'method_missing':未定义的方法`active_storage'for(NoMethodError)

[英]'method_missing': undefined method `active_storage' for (NoMethodError)

I currently generated a Ruby on Rails 5.2 application. 我目前生成了一个Ruby on Rails 5.2应用程序。 When I run rails active_storage:install it created a 20180915211415_create_active_storage_tables migration. 当我运行rails active_storage:install它创建了一个20180915211415_create_active_storage_tables迁移。 However, I run into the following error when I try to start the server. 但是,当我尝试启动服务器时,我遇到以下错误。

/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)

Here is my gemfile: 这是我的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]

In the application.rb file: 在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

I followed the instructions for the installation in the following article : However, that gave me problems so I decided to delete the application and start from scratch. 我按照以下文章中的安装说明进行操作:但是,这给了我一些问题,所以我决定删除应用程序并从头开始。 rails _5.2.1_ new vuejs-ror-setup -M -C -S --skip-turbolinks --webpack=vue -d postgresql

In the following way. 通过以下方式。 Not sure whats causing this error? 不知道什么导致了这个错误?

You need to load Active Storage with the other frameworks: 您需要使用其他框架加载Active Storage:

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

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 `method_missing&#39;:Emailer:Class 的未定义方法 `mail&#39;(NoMethodError) - `method_missing': undefined method `mail' for Emailer:Class (NoMethodError) Ruby on Rails`method_missing':未定义的方法`active_record' - Ruby on Rails `method_missing': undefined method `active_record' Rails 4.2.3`method_missing&#39;:未定义的方法`active_record&#39; - Rails 4.2.3 `method_missing': undefined method `active_record' 获取`method_missing&#39;:#的未定义方法`this&#39; <Gem::Specification: nokogiri-1.6.7.2> (NoMethodError) - Getting `method_missing': undefined method `this' for #<Gem::Specification: nokogiri-1.6.7.2> (NoMethodError) `method_missing&#39;:#的未定义方法&#39;assets&#39; <Rails::Engine::Configuration:0x9d6a6d8> (NoMethodError) - `method_missing': undefined method `assets' for #<Rails::Engine::Configuration:0x9d6a6d8> (NoMethodError) active_storage/direct_uploads 在 blob.rb 中为 nil:NilClass 抛出“未定义的方法 'name'” - active_storage/direct_uploads throws 'undefined method 'name' for nil:NilClass' in blob.rb' `method_missing&#39;:#的未定义方法`active_record&#39; - `method_missing': undefined method `active_record' for #<Rails::Application::Configuration - Rails with MongoDB Rails的错误:`method_missing&#39;:未定义的方法`active_record&#39; - Rails s error: `method_missing': undefined method `active_record' Rails控制台提供method_missing,未定义 - rails console gives method_missing, undefined Rails Active Storage NoMethodError - nil:NilClass 的未定义方法“[]”: - Rails Active Storage NoMethodError - undefined method `[]' for nil:NilClass:
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM