phil
phil

Reputation: 4908

NameError (uninitialized constant ActiveStorage::Downloading)

I am running Rails 6.0.3.2 and ruby 2.6.6

I am trying to use the ActiveStorage::Downloading class but can't figure out how to get it to load! I am getting the error

irb(main):001:0>   include ActiveStorage::Downloading
Traceback (most recent call last):
        1: from (irb):1
NameError (uninitialized constant ActiveStorage::Downloading)

I'm pretty sure this is me, but I can't figure it out. I am using ActiveStorage already in the project, but want to use the download_blob_to_tempfile method.

Upvotes: 2

Views: 1128

Answers (1)

Aarthi
Aarthi

Reputation: 1521

First, load the library by using require and include to use the methods of that module.

require 'active_storage/downloading'
include ActiveStorage::Downloading

Upvotes: 1

Related Questions