classiccms 0.6.0 → 0.6.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -5,6 +5,38 @@ end
5
5
  Mongoid::Fields.option :options do |model, field, value|
6
6
  #model.validates_presence_of field if value
7
7
  end
8
+ class ImageType
9
+ attr_reader :image_id
10
+
11
+ def initialize(image_id)
12
+ @image_id
13
+ end
14
+
15
+ class << self
16
+
17
+ # Get the object as it was stored in the database, and instantiate
18
+ # this custom class from it.
19
+ def demongoize(object_id)
20
+ Image.find(object_id).file
21
+ end
22
+
23
+ # Takes any possible object and converts it to how it would be
24
+ # stored in the database.
25
+ def mongoize(object_id)
26
+ object_id
27
+ end
28
+
29
+ # Converts the object that was supplied to a criteria and converts it
30
+ # into a database friendly form.
31
+ def evolve(object)
32
+ case object
33
+ when ImageType then object.mongoize
34
+ else object
35
+ end
36
+ end
37
+ end
38
+ end
39
+
8
40
  class Base
9
41
  include Mongoid::Document
10
42
  include Mongoid::Timestamps
@@ -1,3 +1,3 @@
1
1
  module Classiccms #:nodoc
2
- VERSION = "0.6.0"
2
+ VERSION = "0.6.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: classiccms
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.6.1
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: 2012-10-03 00:00:00.000000000 Z
12
+ date: 2012-10-08 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec