Forum: Ruby on Rails how to create test data using migration for file_column

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Cedric C. (Guest)
on 2008-10-13 07:19

i would like to create test data for my client using migration.

for example:
:name => 'john',
:age => '28'

how would one do that for the file_column "image" field? i have tried to
give the name of the file XXXX.jpg, but i get the following error

"Do not know how to handle a string with value 'XXXXX.jpg' that was
passed to a file_column. Check if the form's encoding has been set to

thanks a lot
Alex B. (Guest)
on 2008-10-13 17:05
(Received via mailing list)
The easy way to display this is to just store the binary data of the

So you'd have a blob column called image...

  :name => 'john',
  :image =>"/Path/To/Image/File/john.jpg")

Check out
for some image handling tips.

On Oct 12, 11:19 pm, Cedric C. <removed_email_address@domain.invalid>
This topic is locked and can not be replied to.