Rails 5.2 Active storage Unable to autoload constant ActiveStorage::Blob::Analyzable

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Rails 5.2 Active storage Unable to autoload constant ActiveStorage::Blob::Analyzable

Mattia Antonini
I've updated rails from 5.1.4 to 5.2 and remove Papaerclip to use Active Storage. I'm using digitalocean spaces. In my development env I've setted credentials in storage.yml to save images to digitalocean.

I've added aws gem in gemfile. I run db:migrate for active storage.

But when I'm going to submit the form with an image upload html tag, i receive this error: Unable to autoload constant ActiveStorage::Blob::Analyzable.

Anyone can help me?

Thanks in advance.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/6c0c4919-81c4-4c08-b8b6-131ab76bf2f0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Rails 5.2 Active storage Unable to autoload constant ActiveStorage::Blob::Analyzable

Frantz Augustin

Frantz Augustin
Founder @ Club Artizan


On Sun, Jun 10, 2018 at 11:23 AM, Mattia Antonini <[hidden email]> wrote:
I've updated rails from 5.1.4 to 5.2 and remove Papaerclip to use Active Storage. I'm using digitalocean spaces. In my development env I've setted credentials in storage.yml to save images to digitalocean.

I've added aws gem in gemfile. I run db:migrate for active storage.

But when I'm going to submit the form with an image upload html tag, i receive this error: Unable to autoload constant ActiveStorage::Blob::Analyzable.

Anyone can help me?

Thanks in advance.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/6c0c4919-81c4-4c08-b8b6-131ab76bf2f0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CAP19LVW1ddAAf5NN8dVwvUwba-S0EWao46DT_vDjhYXsO0Ou%3DQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Rails 5.2 Active storage Unable to autoload constant ActiveStorage::Blob::Analyzable

Skt Hg
Hi Frantz

I have an issue similar to Mattia's, so I tried your suggestion.
Thanks for the advice, although installing mini_magick (v4.8) didn't solve the issue for me.

For context, I'm on ruby 2.4.2 / rails 5.2 / active storage 5.2
I followed this tutorial for the active storage setup

I tried to upload via a form and to directly attach a local file to an existing object in the rails console.
Strangely enough I have a first `NoMethodError: undefined method `[]' for nil:NilClass` when trying the first time, 
and the `Unable to autoload constant ActiveStorage::Blob::Analyzable` error the second time.

The full session log if it helps:

==========================
2.4.2 :001 > store = Store.first  Store Load (0.3ms)  SELECT  "stores".* FROM "stores" ORDER BY "stores"."id" ASC LIMIT $1  [["LIMIT", 1]] => #<Store id: "b02fb2d3-0d0a-4edd-9620-a770be10479b", subdomain: "test2", name: "new store", created_at: "2018-06-12 09:25:28", updated_at: "2018-06-1209:25:28">
2.4.2 :002 >
2.4.2 :003 >
2.4.2 :004 >
2.4.2 :005 >
2.4.2 :006 >   store.header_image.attach(io: File.open('/Users/skthg/Downloads/stock-photo-macro-close-up-portrait-of-woman-having-facial-beauty-treatment-in-spa-therapist-massaging-chin-693071524.jpg'), filename:'chin.jpg', content_type: 'image/jpeg', identify: false)
  ActiveStorage::Attachment Load (0.4ms)  SELECT  "active_storage_attachments".* FROM "active_storage_attachments" WHERE "active_storage_attachments"."record_id" = $1 AND "active_storage_attachments"."record_type" = $2 AND "active_storage_attachments"."name" = $3 LIMIT $4  [["record_id", 0], ["record_type", "Store"], ["name", "header_image"], ["LIMIT", 1]]
NoMethodError: undefined method `[]' for nil:NilClass
        from (erb):12:in `<main>'
        from (irb):6
2.4.2 :007 > store.header_image.attach(io: File.open('/Users/skthg/Downloads/stock-photo-macro-close-up-portrait-of-woman-having-facial-beauty-treatment-in-spa-therapist-massaging-chin-693071524.jpg'), filename:'chin.jpg', content_type: 'image/jpeg', identify: false)
LoadError: Unable to autoload constant ActiveStorage::Blob::Analyzable, expected /Users/skthg/.rvm/gems/ruby-2.4.2/gems/activestorage-5.2.0/app/models/active_storage/blob/analyzable.rb to define it
        from (irb):7
2.4.2 :008 >




Regards

2018年6月11日月曜日 18時46分15秒 UTC+2 Frantz Augustin:
Hi Mattia,

Did you install MiniMagic Gem

<a href="http://api.rubyonrails.org/classes/ActiveStorage/Analyzer/ImageAnalyzer.html" target="_blank" rel="nofollow" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fapi.rubyonrails.org%2Fclasses%2FActiveStorage%2FAnalyzer%2FImageAnalyzer.html\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNFsIWAE68Lbyvitjz5ald4ib7FiGA&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fapi.rubyonrails.org%2Fclasses%2FActiveStorage%2FAnalyzer%2FImageAnalyzer.html\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNFsIWAE68Lbyvitjz5ald4ib7FiGA&#39;;return true;">http://api.rubyonrails.org/classes/ActiveStorage/Analyzer/ImageAnalyzer.html



Frantz Augustin
Founder @ Club Artizan
<a href="https://clubartizan.com" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fclubartizan.com\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNGpk87-P9d_kBtGSFWN7bbMavHjeg&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fclubartizan.com\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNGpk87-P9d_kBtGSFWN7bbMavHjeg&#39;;return true;">clubartizan.com


On Sun, Jun 10, 2018 at 11:23 AM, Mattia Antonini <<a href="javascript:" target="_blank" gdf-obfuscated-mailto="mjgQbYalBQAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">mattia.an...@...> wrote:
I've updated rails from 5.1.4 to 5.2 and remove Papaerclip to use Active Storage. I'm using digitalocean spaces. In my development env I've setted credentials in storage.yml to save images to digitalocean.

I've added aws gem in gemfile. I run db:migrate for active storage.

But when I'm going to submit the form with an image upload html tag, i receive this error: Unable to autoload constant ActiveStorage::Blob::Analyzable.

Anyone can help me?

Thanks in advance.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to <a href="javascript:" target="_blank" gdf-obfuscated-mailto="mjgQbYalBQAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">rubyonrails-ta...@googlegroups.com.
To post to this group, send email to <a href="javascript:" target="_blank" gdf-obfuscated-mailto="mjgQbYalBQAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">rubyonra...@googlegroups.com.
To view this discussion on the web visit <a href="https://groups.google.com/d/msgid/rubyonrails-talk/6c0c4919-81c4-4c08-b8b6-131ab76bf2f0%40googlegroups.com" rel="nofollow" target="_blank" onmousedown="this.href=&#39;https://groups.google.com/d/msgid/rubyonrails-talk/6c0c4919-81c4-4c08-b8b6-131ab76bf2f0%40googlegroups.com&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/msgid/rubyonrails-talk/6c0c4919-81c4-4c08-b8b6-131ab76bf2f0%40googlegroups.com&#39;;return true;">https://groups.google.com/d/msgid/rubyonrails-talk/6c0c4919-81c4-4c08-b8b6-131ab76bf2f0%40googlegroups.com.
For more options, visit <a href="https://groups.google.com/d/optout" rel="nofollow" target="_blank" onmousedown="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;">https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/bbce1fa7-65ec-48b7-8ae2-1f690d9f6a3d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Rails 5.2 Active storage Unable to autoload constant ActiveStorage::Blob::Analyzable

Skt Hg
Replying to myself in case someone hits the same issue.

First thanks Frank for the pointers you sent me. I am new to rails so it was very helpful to debug from a clean state.

I got to solve it, the main issue for me was a parsing error in the ‘storage.yml’ file. The storage engine was chocking on it, even if the file was passing several linters fine.
I kept the original file for later review, but rewriting it from scratch solved the issue.

Best

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/3d425c73-21c8-47b1-b353-f6f09716cb6d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Rails 5.2 Active storage Unable to autoload constant ActiveStorage::Blob::Analyzable

Frantz Augustin
I am glad you solved it.

Frantz Augustin
Founder @ Club Artizan


On Tue, Jun 12, 2018 at 2:04 PM, Skt Hg <[hidden email]> wrote:
Replying to myself in case someone hits the same issue.

First thanks Frank for the pointers you sent me. I am new to rails so it was very helpful to debug from a clean state.

I got to solve it, the main issue for me was a parsing error in the ‘storage.yml’ file. The storage engine was chocking on it, even if the file was passing several linters fine.
I kept the original file for later review, but rewriting it from scratch solved the issue.

Best

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/3d425c73-21c8-47b1-b353-f6f09716cb6d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CAP19LVVrCKOiuwXDzZ0DGTFEq2UWqtu2yutia8J%3DvspTPWB5ow%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Rails 5.2 Active storage Unable to autoload constant ActiveStorage::Blob::Analyzable

Mattia Antonini
In reply to this post by Skt Hg
Hi Skt Hg,

Could you tell me, step by step, how you solved this problem?
I'm new to rails too.

Thanks, Mattia.

Il giorno martedì 12 giugno 2018 20:04:36 UTC+2, Skt Hg ha scritto:
Replying to myself in case someone hits the same issue.

First thanks Frank for the pointers you sent me. I am new to rails so it was very helpful to debug from a clean state.

I got to solve it, the main issue for me was a parsing error in the ‘storage.yml’ file. The storage engine was chocking on it, even if the file was passing several linters fine.
I kept the original file for later review, but rewriting it from scratch solved the issue.

Best

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/a38193f6-0c14-4421-9050-b06ad2c305a7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.