mercredi 21 novembre 2018

SQLite3::BusyException attaching files in seeds.rb

I'm trying to enter data in my seeds file and include attachments as so but it's throwing this error:

SQLite3::BusyException: database is locked

I know the error is the way i'm entering the data and attaching a file but I don't how how else to do multiple records! Help is much appreciated.

This is my seeds file

(v = Apple.create( color: 'Black', size: 'Big', taste: 'bitter;, price: '40,000')
 v.image.attach(io: File.open('app/assets/images/v.jpg'), filename: 'v.jpg'))

(v1 = Apple.create( color: 'Blue', size: 'Big' taste: 'bitter', price: '39,000')
 v1.image.attach(io: File.open('app/assets/images/v1.jpg'), filename:'v1.jpg'))

Aucun commentaire:

Enregistrer un commentaire