Procedure for uploading images to AWS S3 using carrierwave in Rails

Asked 2 years ago, Updated 2 years ago, 43 views

Thank you for your help.
I was trying to upload the image to AWS S3 using carrierwave in Rails, but I would like to ask you to let me know.
https://qiita.com/junara/items/1899f23c091bcee3b058#s3%E3%83%90%E3%82%B1%E3%83%83%E3%83%88%E4%BD%9C%E6%88%90

Prerequisite

  • rails Installed
  • AWS Account Created
  • Deployed to EC2
  • S3 bucket created

What do you want to solve
After adding the photo model and configuring the image column,

rakedb:migrate?
rails db —migrate?
Directly inheriting from ActiveRecord:: Migration is not supported. Please specify the Rails release the migration was written for:
Direct inheritance of ActiveRecord::Migration is not supported.Specify the Rails release with the migration written on it.

and errors.

What I looked into myself
Searched Directly Inheriting from ActiveRecord::Migration is not supported.
https://qiita.com/baby-0105/items/184048e18a8b1de93a31

The results of hypotheses and validations
The following did not resolve the issue:

$rails db:migrate:reset
$ rails db:migrate

Are there times when migration is not possible due to different versions?
Please let me know.

①https://gyazo.com/477cef32b2d842fa0e6e3bffeb373048
②https://gyazo.com/a1a68a7984ba9c1a97c59d10c29325d2

%ruby-v
ruby 2.6.5p114 (2019-10-01 revision 67812) [x86_64-darwin19]
% rails-v
Rails 6.0.3.4
% gem-v
3.0.3

ruby-on-rails ruby

2022-09-30 20:10

1 Answers

in https://gyazo.com/a1a68a7984ba9c1a97c59d10c29325d2

class CreatePhotos<ActiveRecord::Migration and

I think I could only write around Rails 4 or 5.0.

Here

class CreatePhotos<ActiveRecord:Migration [6.0]

I think it would be good to try rails db:migrate again


2022-09-30 20:10

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.