diff options
author | Christoph Helma <helma@in-silico.ch> | 2015-07-27 20:51:25 +0200 |
---|---|---|
committer | Christoph Helma <helma@in-silico.ch> | 2015-07-27 20:51:25 +0200 |
commit | 3cea6abe3606ea586b733e943737f77d58f215f9 (patch) | |
tree | dac742811597f550ea0eef5793af2d9596d99638 /lib/data_entry.rb | |
parent | cd1cba67830505cd2d23ec83e64c0beed42a9f28 (diff) |
reasonable query performace for data_entries
Diffstat (limited to 'lib/data_entry.rb')
-rw-r--r-- | lib/data_entry.rb | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/lib/data_entry.rb b/lib/data_entry.rb index 9f6e786..4eeb66d 100644 --- a/lib/data_entry.rb +++ b/lib/data_entry.rb @@ -1,15 +1,18 @@ module OpenTox class DataEntry - #field :feature_id, type: BSON::ObjectId - #field :compound_id, type: BSON::ObjectId + field :feature_id, type: BSON::ObjectId + field :compound_id, type: BSON::ObjectId # Kludge because csv import removes type information - field :feature_id, type: String - field :compound_id, type: String + #field :feature_id, type: String + #field :compound_id, type: String field :value field :warnings, type: String field :unit, type: String store_in collection: "data_entries" + belongs_to :dataset + has_one :compound + has_one :feature # preferred method for the insertion of data entries # @example DataEntry.find_or_create compound,feature,value @@ -32,5 +35,6 @@ module OpenTox def self.[](compound,feature) self.where(:compound_id => compound.id.to_s, :feature_id => feature.id.to_s).distinct(:value).first end + end end |