mongoid_silo 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
data/app/models/silo.rb CHANGED
@@ -9,8 +9,17 @@ class Silo
9
9
  field :silo_type, type: String
10
10
  field :bag, type: Hash
11
11
 
12
-
13
12
  index item_class: 1
14
13
  index item_id: 1
15
14
  index silo_type: 1
15
+
16
+ def to_json
17
+ @json ||= Multijson.encode bag
18
+ end
19
+
20
+ class << self
21
+ def for_id_and_class_with_name id, class_name, silo_name
22
+ where(item_class: class_name, item_id: id, silo_type: silo_name).first
23
+ end
24
+ end
16
25
  end
@@ -1,3 +1,3 @@
1
1
  module MongoidSilo
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mongoid_silo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-01-02 00:00:00.000000000 Z
12
+ date: 2013-01-03 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport