Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在使用 Ruby,或者更具体地说是带有Sequel ORM的Ramaze框架。所以请不要告诉我Paperclip gem,因为它只与 ActiveRecord 兼容。
考虑到这一点,如何使用 Ruby 和 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')))