3
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

ActiveStorageのseedデータを投入する際のエラー

Posted at

Railsでアプリを作成する際、ActiveStorageを使って画像のseedデータを投入しようとしたところ、少しはまったので備忘録です。

seedデータが通らない

記事などを参考に

seeds.rb
user = User.find(1)
user.image.attach(io: File.open('app/assets/images/test.jpg'), filename: 'test.jpg')

とした後、

$ rails db:seed

としても通らないので、ぐぐってみる。

config/environments/development.rb
config.active_job.queue_adapter = :inline

を追記したら無事とおりました。

3
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?