The easy way to display this is to just store the binary data of the
file.
So you''d have a blob column called image...
Model.create(
:name => ''john'',
:image => File.read("/Path/To/Image/File/john.jpg")
)
Check out
http://www.mattberther.com/2007/10/19/uploading-files-to-a-database-using-rails/
for some image handling tips.
On Oct 12, 11:19 pm, Cedric Ced
<rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org>
wrote:> Hi,
>
> i would like to create test data for my client using migration.
>
> for example:
> Model.create(
> :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
> message:
>
> "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
> ''multipart/form-data''."
>
> thanks a lot
> --
> Posted viahttp://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---