无法在rails上向seeds.rb-ruby添加图像



我正试图在我的ruby on rails应用程序中向我的seeds.rb添加图像。然而,这些图像无法保存,我无法在应用程序中显示它们。当我运行rails db:seed时,我不会得到错误。我正在使用活动存储。

我希望你能帮我!

product-card.html.erbseeds.rb

在进行附加之前,您希望保留记录。下面是我的种子文件中的一个例子:

person =
FactoryBot.create(
:person,
account:,
name: Faker::TvShows::FamilyGuy.unique.character
)
person.avatar.attach(
filename: 'avatar.jpg',
io: URI.open('https://api.lorem.space/image/face')
)

最新更新