bperlik
bperlik

Reputation: 23

No method error on active storage with Rails 5.2

In a rails engine using RSpec for testing, I have to list my rails frameworks instead of using include "rails/all" so the mini-test unit isn't created. I keep getting a no method error or active storage. Its a new feature of Rails 5.2 to enable storage on cloud sources, but I can't find a way to require that feature. I tried "activestorage" and activestorage/railties". I installed active storage.

# require 'rails/all'   # cannot use due to RSpec instead of mini-test
require "active_record/railtie"
require "action_controller/railtie"
require "action_mailer/railtie"
require "action_view/railtie"
require "sprockets/railtie"

Upvotes: 0

Views: 522

Answers (1)

e_a_o
e_a_o

Reputation: 601

It'd be great to see a stack trace of what your error looks like. However, maybe this will help. For using Rails 5.2.0 with RSpec and ActiveStorage, this is what my config/application.rb looks like:

# config/application.rb

require 'rails'
# Pick the frameworks you want:
require 'active_model/railtie'
require 'active_job/railtie'
require 'active_record/railtie'
require 'active_storage/engine'
require 'action_controller/railtie'
require 'action_mailer/railtie'
require 'action_view/railtie'
require 'sprockets/railtie'

If the above doesn't help, please update your question with the command you ran and the full stack trace of the errors you're getting.

Upvotes: 3

Related Questions