diff options
Diffstat (limited to 'application.rb')
-rw-r--r-- | application.rb | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/application.rb b/application.rb index eb6d53a..79063f5 100644 --- a/application.rb +++ b/application.rb @@ -24,16 +24,19 @@ class ModelStore end =end -class PredictionCache +class PredictionCache < Ohm::Model # cache predictions - include DataMapper::Resource - property :id, Serial - property :compound_uri, String, :length => 255 - property :model_uri, String, :length => 255 - property :dataset_uri, String, :length => 255 + #include DataMapper::Resource + #attribute :id, Serial + attribute :compound_uri + attribute :model_uri + attribute :dataset_uri + + index :compound_uri + index :model_uri end -DataMapper.auto_upgrade! +#DataMapper.auto_upgrade! before do @accept = request.env['HTTP_ACCEPT'] @@ -139,7 +142,8 @@ end delete '/?' do # TODO delete datasets FileUtils.rm Dir["public/*.yaml"] - PredictionCache.auto_migrate! + PredictionCache.all.each {|cache| cache.delete } + #PredictionCache.auto_migrate! response['Content-Type'] = 'text/plain' "All models and cached predictions deleted." end |