I am using Ruby, or more specifically the Ramaze framework with the Sequel ORM . So please don't tell me about the Paperclip gem, as it is only compatible with ActiveRecord.
With that in mind, how can I store an image in a database using Ruby and Sequel?
require "sequel"
DB = Sequel.sqlite
DB.create_table :images do
primary_key :id
String :name
File :data
end
images = DB[:images]
images.insert(name: 'foo', data: Sequel.blob(File.read('/mydir/myimage.jpg')))
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.