summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorroot <root@ot-dev.in-silico.ch>2011-02-25 17:54:39 +0000
committerroot <root@ot-dev.in-silico.ch>2011-02-25 17:54:39 +0000
commitd3dfccb8e46e1d5677877b833fa81acad4d026d4 (patch)
tree5ce6db2f7d0e5ceae27f73acfa4d9cb40a88eeb5 /lib
parent96e7db0a280ed3f28266a117a27cc69cb800063f (diff)
ohm/redis backend
Diffstat (limited to 'lib')
-rw-r--r--lib/environment.rb2
-rw-r--r--lib/opentox-ruby.rb2
-rw-r--r--lib/overwrite.rb6
3 files changed, 9 insertions, 1 deletions
diff --git a/lib/environment.rb b/lib/environment.rb
index 5b16e4a..73df64e 100644
--- a/lib/environment.rb
+++ b/lib/environment.rb
@@ -52,6 +52,8 @@ if CONFIG[:database]
#DataMapper.setup(:default, {:adapter => "redis"})
#DataMapper::Model.raise_on_save_failure = true
+ require 'ohm'
+ Ohm.connect :thread_safe => true
end
# load mail settings for error messages
diff --git a/lib/opentox-ruby.rb b/lib/opentox-ruby.rb
index 735b845..ab8d824 100644
--- a/lib/opentox-ruby.rb
+++ b/lib/opentox-ruby.rb
@@ -1,4 +1,4 @@
-['rubygems', 'sinatra', 'sinatra/url_for', 'rest_client', 'yaml', 'cgi', 'spork', 'error', 'overwrite', 'environment'].each do |lib|
+['rubygems', 'sinatra', 'sinatra/url_for', 'ohm', 'rest_client', 'yaml', 'cgi', 'spork', 'error', 'overwrite', 'environment'].each do |lib|
require lib
end
diff --git a/lib/overwrite.rb b/lib/overwrite.rb
index b5c3942..fbe775d 100644
--- a/lib/overwrite.rb
+++ b/lib/overwrite.rb
@@ -137,3 +137,9 @@ class OTLogger < Logger
end
+# make migration from datamapper more straightforward
+class Ohm::Model
+ def self.get(id)
+ self[id]
+ end
+end