Sha256: ae5f073ed75fcaa1ed742c526821805e26d127625ee645a054707e38dddcda15
Contents?: true
Size: 883 Bytes
Versions: 9
Compression:
Stored size: 883 Bytes
Contents
module Copy module Storage class Relational class Document include DataMapper::Resource storage_names[:default] = 'copy_documents' property :id, Serial property :name, String, :unique_index => true property :content, Text end if defined?(DataMapper::Resource) def initialize(connection_url) DataMapper.setup(:default, connection_url) DataMapper.finalize DataMapper.auto_upgrade! end def get(name) doc = Document.first(:name => name) doc.content unless doc.nil? end def set(name, content) doc = Document.first(:name => name) if doc doc.update(:content => content) else Document.create(:name => name, :content => content) end end end end end
Version data entries
9 entries across 9 versions & 2 rubygems