0

I tried this rails active_storage:install gives error but still I am getting the same error

Don't know how to build task 'active_storage:install'

rails 5.2.1 ruby 2.5.1

Couldn't get the server started as well.

/usr/local/lib/ruby/gems/2.5.0/gems/railties-5.2.1/lib/rails/railtie/configuration.rb:97:in `method_missing': undefined method `active_storage' for #<Rails::Application::Configuration:0x00007fc9493b7738> (NoMethodError)

I can get the server running if config.active_storage.service = :local is commented.

Sorry if I make any mistake, first time asking question here and newbie to RoR. Thanks!


Update: config/application.rb:

require_relative 'boot'
require 'rails/all'
Bundler.require(*Rails.groups)
module Blogclass Application < Rails::Application
config.load_defaults 5.2
end
end

Gemfile:

source 'https://rubygems.org'
git_source(:github) { |repo| "https://github.com/#{repo}.git" }

ruby '2.5.1'

gem 'rails', '~> 5.2.0'
gem 'sqlite3'
gem 'puma', '~> 3.11'
gem 'sass-rails', '~> 5.0'
gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.2'
gem 'turbolinks', '~> 5'
gem 'jbuilder', '~> 2.5'
gem 'bootsnap', '>= 1.1.0', require: false

group :development, :test do
  gem 'byebug', platforms: [:mri, :mingw, :x64_mingw]
end

group :development do
  gem 'web-console', '>= 3.3.0'
  gem 'listen', '>= 3.0.5', '< 3.2'
  gem 'spring'
  gem 'spring-watcher-listen', '~> 2.0.0'
end

group :test do
  gem 'capybara', '>= 2.15', '< 4.0'
  gem 'selenium-webdriver'
  gem 'chromedriver-helper'
end

gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
kailoon
  • 13
  • 1
  • 5

2 Answers2

0

Add require "active_storage/engine" under rails/all in your config/application.rb

require_relative 'boot'
require 'rails/all'
require "active_storage/engine"
Bundler.require(*Rails.groups)
module Blogclass Application < Rails::Application
config.load_defaults 5.2
end
end
maxadorable
  • 1,290
  • 1
  • 10
  • 24
  • thanks @Auriga Now I am getting `from /usr/local/lib/ruby/gems/2.5.0/gems/activesupport-5.2.1/lib/active_support/dependencies.rb:287:in block in require' /usr/local/lib/ruby/gems/2.5.0/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in require': cannot load such file -- marcel` – kailoon Nov 13 '18 at 03:10
0

Try to add

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

For more details follow the link

application.rb file look like:

# application.rb 
require_relative 'boot'
require "active_storage/engine"

require "rails"
# Pick the frameworks you want:
require "active_storage/engine"
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
Mayur Shah
  • 3,344
  • 1
  • 22
  • 41
  • Thanks, but it doesn't work. Same error. I am wondering, why I need to add the activestorage gem, isn't it bundled into rails 5.2? – kailoon Nov 13 '18 at 04:54
  • Look at the GitHub repo and try to follow installation steps. https://github.com/rails/activestorage/tree/archive#installation – Mayur Shah Nov 13 '18 at 04:57
  • I am sorry but I don't understand. 1. I am on a fresh new app using rails 5.2, why I need to add this gem into the Gemfile? 2. `gem "activestorage", git: "https://github.com/rails/activestorage.git"` this won't work because the repo is archived. 3. I try this instead https://github.com/rails/rails/tree/master/activestorage but still, I am getting `LoadError: cannot load such file -- marcel` when I do `rails active_storage:install`. Thanks for your help – kailoon Nov 13 '18 at 05:12
  • @kailoon 1) Not need to add gem into gemfile if you are using 5.2 version 2) Correct the repo is archived so use github.com/rails/rails/tree/master/activestorage – Mayur Shah Nov 13 '18 at 05:18
  • Try to update your bootsnap gem `bundle update bootsnap` follow link for reference https://github.com/Shopify/bootsnap/issues/73 or https://stackoverflow.com/questions/51493625/new-to-rails-rails-server-error-cannot-load-such-file-bootsnap-setup-load – Mayur Shah Nov 13 '18 at 05:39