Meenakshi Badhan

Joined

50 Experience
0 Lessons Completed
0 Questions Solved

Activity

I'm setting active storage with s3 in Rails 6.

  • I did rails active_storage:install and db:migrate.
  • In development.rb, i added: config.active_storage.service = :amazon
  • I added gem "aws-sdk-s3", require: false in my gemfile.
  • My model has this: has_one_attached :photo
  • This is my storage.yml.
 test:
    service: Disk
    root: <%= Rails.root.join("tmp/storage") %>

  local:
    service: Disk
    root: <%= Rails.root.join("storage") %>

  amazon:
    service: "S3"
    access_key_id: xxxx
    secret_access_key: xxxx
    region: xxxx
    bucket: xxxx
  • But on calling model.photo.attach(params[:photo']), i'm getting this error.
    *** NameError Exception: uninitialized constant #<Class:0x00007fddde3597d8>::Analyzable

  • My yml seems to be correct, i already checked it in yml validator. But,
    Rails.application.config_for(:storage) returns {}

Any suggestions would help.

logo Created with Sketch.

Ruby on Rails tutorials, guides, and screencasts for web developers learning Ruby, Rails, Javascript, Turbolinks, Stimulus.js, Vue.js, and more. Icons by Icons8

© 2020 GoRails, LLC. All rights reserved.