mongomodel 0.5.5 → 0.5.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (156) hide show
  1. checksums.yaml +5 -5
  2. data/.travis.yml +23 -11
  3. data/gemfiles/rails-3.2.gemfile +2 -2
  4. data/gemfiles/rails-4-observers.gemfile +1 -1
  5. data/gemfiles/rails-4.1.gemfile +2 -2
  6. data/gemfiles/{mongoid.gemfile → rails-4.2.gemfile} +2 -3
  7. data/gemfiles/{mongo_mapper.gemfile → rails-5.0.gemfile} +2 -3
  8. data/gemfiles/rails-5.1.gemfile +10 -0
  9. data/gemfiles/rails-5.2.gemfile +10 -0
  10. data/lib/mongomodel.rb +15 -15
  11. data/lib/mongomodel/attributes/mongo.rb +7 -7
  12. data/lib/mongomodel/attributes/store.rb +4 -4
  13. data/lib/mongomodel/attributes/typecasting.rb +7 -7
  14. data/lib/mongomodel/compatibility/mongo_mapper.rb +3 -3
  15. data/lib/mongomodel/compatibility/mongoid.rb +3 -3
  16. data/lib/mongomodel/concerns/abstract_class.rb +3 -3
  17. data/lib/mongomodel/concerns/activemodel.rb +4 -4
  18. data/lib/mongomodel/concerns/associations.rb +8 -8
  19. data/lib/mongomodel/concerns/associations/base/association.rb +5 -5
  20. data/lib/mongomodel/concerns/associations/base/definition.rb +4 -4
  21. data/lib/mongomodel/concerns/associations/base/proxy.rb +1 -1
  22. data/lib/mongomodel/concerns/associations/belongs_to.rb +19 -19
  23. data/lib/mongomodel/concerns/associations/has_many_by_foreign_key.rb +36 -36
  24. data/lib/mongomodel/concerns/associations/has_many_by_ids.rb +34 -34
  25. data/lib/mongomodel/concerns/attribute_methods.rb +10 -10
  26. data/lib/mongomodel/concerns/attribute_methods/before_type_cast.rb +4 -4
  27. data/lib/mongomodel/concerns/attribute_methods/dirty.rb +95 -13
  28. data/lib/mongomodel/concerns/attribute_methods/forbidden.rb +1 -1
  29. data/lib/mongomodel/concerns/attribute_methods/multi_parameter_assignment.rb +6 -6
  30. data/lib/mongomodel/concerns/attribute_methods/nested.rb +18 -18
  31. data/lib/mongomodel/concerns/attribute_methods/protected.rb +3 -3
  32. data/lib/mongomodel/concerns/attribute_methods/query.rb +3 -3
  33. data/lib/mongomodel/concerns/attribute_methods/read.rb +4 -4
  34. data/lib/mongomodel/concerns/attribute_methods/write.rb +4 -4
  35. data/lib/mongomodel/concerns/attributes.rb +18 -18
  36. data/lib/mongomodel/concerns/callbacks.rb +7 -7
  37. data/lib/mongomodel/concerns/document_parent.rb +2 -2
  38. data/lib/mongomodel/concerns/logging.rb +2 -2
  39. data/lib/mongomodel/concerns/map_reduce.rb +11 -11
  40. data/lib/mongomodel/concerns/pretty_inspect.rb +3 -3
  41. data/lib/mongomodel/concerns/properties.rb +18 -18
  42. data/lib/mongomodel/concerns/record_status.rb +9 -13
  43. data/lib/mongomodel/concerns/serialization.rb +4 -4
  44. data/lib/mongomodel/concerns/timestamps.rb +4 -4
  45. data/lib/mongomodel/concerns/translation.rb +2 -2
  46. data/lib/mongomodel/concerns/validations.rb +5 -5
  47. data/lib/mongomodel/concerns/validations/associated.rb +1 -1
  48. data/lib/mongomodel/document.rb +6 -6
  49. data/lib/mongomodel/document/callbacks.rb +15 -21
  50. data/lib/mongomodel/document/collection_modifiers.rb +5 -5
  51. data/lib/mongomodel/document/dynamic_finders.rb +1 -1
  52. data/lib/mongomodel/document/indexes.rb +19 -19
  53. data/lib/mongomodel/document/optimistic_locking.rb +7 -7
  54. data/lib/mongomodel/document/persistence.rb +23 -23
  55. data/lib/mongomodel/document/scopes.rb +20 -20
  56. data/lib/mongomodel/document/validations.rb +6 -6
  57. data/lib/mongomodel/document/validations/uniqueness.rb +11 -11
  58. data/lib/mongomodel/embedded_document.rb +11 -11
  59. data/lib/mongomodel/locale/en.yml +0 -1
  60. data/lib/mongomodel/log_subscriber.rb +5 -5
  61. data/lib/mongomodel/railtie.rb +13 -13
  62. data/lib/mongomodel/support/collection.rb +31 -31
  63. data/lib/mongomodel/support/configuration.rb +11 -11
  64. data/lib/mongomodel/support/core_extensions.rb +1 -1
  65. data/lib/mongomodel/support/dynamic_finder.rb +12 -12
  66. data/lib/mongomodel/support/exceptions.rb +6 -6
  67. data/lib/mongomodel/support/instrumented_collection.rb +20 -20
  68. data/lib/mongomodel/support/map.rb +33 -33
  69. data/lib/mongomodel/support/mongo_operator.rb +6 -6
  70. data/lib/mongomodel/support/mongo_options.rb +18 -18
  71. data/lib/mongomodel/support/mongo_order.rb +16 -16
  72. data/lib/mongomodel/support/paginator.rb +8 -8
  73. data/lib/mongomodel/support/reference.rb +10 -10
  74. data/lib/mongomodel/support/scope.rb +37 -37
  75. data/lib/mongomodel/support/scope/array_methods.rb +1 -1
  76. data/lib/mongomodel/support/scope/batches.rb +1 -1
  77. data/lib/mongomodel/support/scope/dynamic_finders.rb +1 -1
  78. data/lib/mongomodel/support/scope/finder_methods.rb +7 -7
  79. data/lib/mongomodel/support/scope/load_methods.rb +1 -1
  80. data/lib/mongomodel/support/scope/pagination.rb +1 -1
  81. data/lib/mongomodel/support/scope/query_methods.rb +6 -6
  82. data/lib/mongomodel/support/scope/spawn_methods.rb +8 -8
  83. data/lib/mongomodel/support/types.rb +2 -2
  84. data/lib/mongomodel/support/types/array.rb +1 -1
  85. data/lib/mongomodel/support/types/boolean.rb +3 -3
  86. data/lib/mongomodel/support/types/custom.rb +3 -3
  87. data/lib/mongomodel/support/types/date.rb +2 -2
  88. data/lib/mongomodel/support/types/date_time.rb +6 -16
  89. data/lib/mongomodel/support/types/float.rb +1 -1
  90. data/lib/mongomodel/support/types/hash.rb +1 -1
  91. data/lib/mongomodel/support/types/integer.rb +13 -10
  92. data/lib/mongomodel/support/types/object.rb +5 -5
  93. data/lib/mongomodel/support/types/rational.rb +3 -3
  94. data/lib/mongomodel/support/types/time.rb +2 -2
  95. data/lib/mongomodel/version.rb +1 -1
  96. data/lib/rails/generators/mongo_model/config/templates/mongomodel.yml +3 -4
  97. data/lib/rails/generators/mongo_model/model/model_generator.rb +3 -3
  98. data/mongomodel.gemspec +5 -4
  99. data/spec/mongomodel/attributes/store_spec.rb +21 -21
  100. data/spec/mongomodel/concerns/activemodel_spec.rb +4 -4
  101. data/spec/mongomodel/concerns/associations/base/association_spec.rb +12 -12
  102. data/spec/mongomodel/concerns/associations/belongs_to_spec.rb +34 -21
  103. data/spec/mongomodel/concerns/associations/has_many_by_foreign_key_spec.rb +53 -53
  104. data/spec/mongomodel/concerns/associations/has_many_by_ids_spec.rb +30 -30
  105. data/spec/mongomodel/concerns/attribute_methods/before_type_cast_spec.rb +7 -7
  106. data/spec/mongomodel/concerns/attribute_methods/dirty_spec.rb +45 -41
  107. data/spec/mongomodel/concerns/attribute_methods/multi_parameter_assignment_spec.rb +7 -7
  108. data/spec/mongomodel/concerns/attribute_methods/nested_spec.rb +31 -31
  109. data/spec/mongomodel/concerns/attribute_methods/protected_spec.rb +15 -15
  110. data/spec/mongomodel/concerns/attribute_methods/query_spec.rb +19 -19
  111. data/spec/mongomodel/concerns/attribute_methods/read_spec.rb +9 -9
  112. data/spec/mongomodel/concerns/attribute_methods/write_spec.rb +6 -6
  113. data/spec/mongomodel/concerns/attribute_methods_spec.rb +13 -13
  114. data/spec/mongomodel/concerns/attributes_spec.rb +34 -34
  115. data/spec/mongomodel/concerns/callbacks_spec.rb +25 -21
  116. data/spec/mongomodel/concerns/logging_spec.rb +5 -3
  117. data/spec/mongomodel/concerns/map_reduce_spec.rb +19 -19
  118. data/spec/mongomodel/concerns/observing_spec.rb +3 -3
  119. data/spec/mongomodel/concerns/pretty_inspect_spec.rb +10 -10
  120. data/spec/mongomodel/concerns/properties_spec.rb +11 -11
  121. data/spec/mongomodel/concerns/serialization/json_serialization_spec.rb +13 -13
  122. data/spec/mongomodel/concerns/timestamps_spec.rb +39 -39
  123. data/spec/mongomodel/concerns/validations_spec.rb +41 -38
  124. data/spec/mongomodel/document/callbacks_spec.rb +20 -16
  125. data/spec/mongomodel/document/collection_modifiers_spec.rb +16 -16
  126. data/spec/mongomodel/document/dynamic_finders_spec.rb +46 -46
  127. data/spec/mongomodel/document/finders_spec.rb +15 -15
  128. data/spec/mongomodel/document/indexes_spec.rb +29 -29
  129. data/spec/mongomodel/document/optimistic_locking_spec.rb +16 -16
  130. data/spec/mongomodel/document/persistence_spec.rb +39 -39
  131. data/spec/mongomodel/document/scopes_spec.rb +17 -17
  132. data/spec/mongomodel/document/validations/uniqueness_spec.rb +46 -46
  133. data/spec/mongomodel/document/validations_spec.rb +35 -35
  134. data/spec/mongomodel/document_spec.rb +19 -19
  135. data/spec/mongomodel/embedded_document_spec.rb +19 -19
  136. data/spec/mongomodel/mongomodel_spec.rb +7 -6
  137. data/spec/mongomodel/support/collection_spec.rb +54 -54
  138. data/spec/mongomodel/support/configuration_spec.rb +1 -1
  139. data/spec/mongomodel/support/map_spec.rb +66 -66
  140. data/spec/mongomodel/support/mongo_operator_spec.rb +5 -5
  141. data/spec/mongomodel/support/mongo_options_spec.rb +42 -42
  142. data/spec/mongomodel/support/mongo_order_spec.rb +24 -24
  143. data/spec/mongomodel/support/paginator_spec.rb +15 -15
  144. data/spec/mongomodel/support/property_spec.rb +29 -23
  145. data/spec/mongomodel/support/scope_spec.rb +205 -204
  146. data/spec/spec_helper.rb +13 -2
  147. data/spec/support/callbacks.rb +3 -8
  148. data/spec/support/helpers/define_class.rb +7 -7
  149. data/spec/support/helpers/document_finder_stubs.rb +6 -6
  150. data/spec/support/helpers/specs_for.rb +1 -1
  151. data/spec/support/helpers/validations.rb +1 -1
  152. data/spec/support/matchers/find_with.rb +8 -8
  153. data/spec/support/matchers/respond_to_boolean.rb +3 -3
  154. data/spec/support/matchers/run_callbacks.rb +6 -9
  155. data/spec/support/models.rb +5 -5
  156. metadata +23 -7
@@ -8,7 +8,7 @@ module MongoModel
8
8
  !empty?
9
9
  end
10
10
  end
11
-
11
+
12
12
  def select(*args, &block)
13
13
  if block_given?
14
14
  to_a.select(&block)
@@ -3,7 +3,7 @@ module MongoModel
3
3
  module Batches
4
4
  def in_batches(batch_size=1000)
5
5
  offset = 0
6
-
6
+
7
7
  begin
8
8
  documents = offset(offset).limit(batch_size).all
9
9
  yield documents if block_given? && !documents.empty?
@@ -8,7 +8,7 @@ module MongoModel
8
8
  super
9
9
  end
10
10
  end
11
-
11
+
12
12
  def method_missing(method_id, *args, &block)
13
13
  if finder = DynamicFinder.match(self, method_id)
14
14
  finder.execute(*args)
@@ -21,7 +21,7 @@ module MongoModel
21
21
  end
22
22
  end
23
23
  end
24
-
24
+
25
25
  def first(count=nil)
26
26
  if loaded?
27
27
  count ? to_a.first(count) : to_a.first
@@ -29,7 +29,7 @@ module MongoModel
29
29
  count ? limit(count).to_a : limit(1).to_a[0]
30
30
  end
31
31
  end
32
-
32
+
33
33
  def last(count=nil)
34
34
  if loaded?
35
35
  count ? to_a.last(count) : to_a.last
@@ -37,24 +37,24 @@ module MongoModel
37
37
  count ? reverse_order.limit(count).to_a : reverse_order.limit(1).to_a[0]
38
38
  end
39
39
  end
40
-
40
+
41
41
  def all
42
42
  to_a
43
43
  end
44
-
44
+
45
45
  def exists?(id)
46
46
  where(:id => id).any?
47
47
  end
48
-
48
+
49
49
  def apply_finder_options(options={})
50
50
  result = clone
51
-
51
+
52
52
  result = result.where(options[:conditions]) if options[:conditions]
53
53
  result = result.order(options[:order]) if options[:order]
54
54
  result = result.select(options[:select]) if options[:select]
55
55
  result = result.limit(options[:limit]) if options[:limit]
56
56
  result = result.offset(options[:offset]) if options[:offset]
57
-
57
+
58
58
  result
59
59
  end
60
60
  end
@@ -2,7 +2,7 @@ module MongoModel
2
2
  class Scope
3
3
  module LoadMethods
4
4
  attr_accessor :on_load_proc
5
-
5
+
6
6
  def on_load(&block)
7
7
  new_scope = clone
8
8
  new_scope.on_load_proc = block
@@ -4,7 +4,7 @@ module MongoModel
4
4
  def paginate(options={})
5
5
  page = options[:page] || 1
6
6
  per_page = options[:per_page] || klass.per_page
7
-
7
+
8
8
  Paginator.new(self, page, per_page)
9
9
  end
10
10
  end
@@ -5,10 +5,10 @@ module MongoModel
5
5
  SINGLE_VALUE_METHODS.each { |m| instance_variable_set("@#{m}_value", nil) }
6
6
  MULTI_VALUE_METHODS.each { |m| instance_variable_set("@#{m}_values", []) }
7
7
  end
8
-
8
+
9
9
  MULTI_VALUE_METHODS.each do |query_method|
10
10
  attr_accessor :"#{query_method}_values"
11
-
11
+
12
12
  class_eval <<-CEVAL, __FILE__
13
13
  def #{query_method}(*args, &block)
14
14
  new_scope = clone
@@ -16,7 +16,7 @@ module MongoModel
16
16
  new_scope.#{query_method}_values += value if value.present?
17
17
  new_scope
18
18
  end
19
-
19
+
20
20
  def #{query_method}!(*args, &block)
21
21
  new_scope = clone
22
22
  value = Array.wrap(args.flatten).reject { |x| x.blank? }
@@ -25,7 +25,7 @@ module MongoModel
25
25
  end
26
26
  CEVAL
27
27
  end
28
-
28
+
29
29
  SINGLE_VALUE_METHODS.each do |query_method|
30
30
  attr_accessor :"#{query_method}_value"
31
31
 
@@ -37,13 +37,13 @@ module MongoModel
37
37
  end
38
38
  CEVAL
39
39
  end
40
-
40
+
41
41
  def from(value, &block)
42
42
  new_scope = clone
43
43
  new_scope.from_value = InstrumentedCollection.new(value.is_a?(String) ? klass.database.collection(value) : value)
44
44
  new_scope
45
45
  end
46
-
46
+
47
47
  def reverse_order
48
48
  if order_values.empty?
49
49
  order(:id.desc)
@@ -3,33 +3,33 @@ module MongoModel
3
3
  module SpawnMethods
4
4
  def merge(scope)
5
5
  result = clone
6
-
6
+
7
7
  MULTI_VALUE_METHODS.each do |method|
8
8
  values = send(:"#{method}_values") + scope.send(:"#{method}_values")
9
9
  result.send(:"#{method}_values=", values.uniq)
10
10
  end
11
-
11
+
12
12
  SINGLE_VALUE_METHODS.each do |method|
13
13
  value = scope.send(:"#{method}_value")
14
14
  result.send(:"#{method}_value=", value) if value
15
15
  end
16
-
16
+
17
17
  result.on_load_proc = scope.on_load_proc
18
-
18
+
19
19
  result
20
20
  end
21
-
21
+
22
22
  def except(*exceptions)
23
23
  result = self.class.new(klass)
24
-
24
+
25
25
  MULTI_VALUE_METHODS.each do |method|
26
26
  result.send(:"#{method}_values=", send(:"#{method}_values")) unless exceptions.include?(method)
27
27
  end
28
-
28
+
29
29
  SINGLE_VALUE_METHODS.each do |method|
30
30
  result.send(:"#{method}_value=", send(:"#{method}_value")) unless exceptions.include?(method)
31
31
  end
32
-
32
+
33
33
  result
34
34
  end
35
35
  end
@@ -4,11 +4,11 @@ require 'mongomodel/support/types/custom'
4
4
  module MongoModel
5
5
  module Types
6
6
  CONVERTERS = Hash.new { |h, k| h[k] = Types::Custom.new(k) }
7
-
7
+
8
8
  def self.register_converter(type, converter)
9
9
  CONVERTERS[type] = converter
10
10
  end
11
-
11
+
12
12
  def self.converter_for(type)
13
13
  CONVERTERS[type]
14
14
  end
@@ -4,7 +4,7 @@ module MongoModel
4
4
  def to_mongo(array)
5
5
  array.map { |i| convert(i) } if array
6
6
  end
7
-
7
+
8
8
  def to_query(value)
9
9
  convert(value)
10
10
  end
@@ -3,7 +3,7 @@ module MongoModel
3
3
  class Boolean < Object
4
4
  TRUE_VALUES = [ true, 'true', 't', 'TRUE', 'T', 'yes', 'YES', 'Y', 'y', '1', 1 ]
5
5
  FALSE_VALUES = [ false, 'false', 'f', 'FALSE', 'F', 'no', 'NO', 'N', 'n', '0', 0 ]
6
-
6
+
7
7
  def cast(value)
8
8
  if true?(value)
9
9
  true
@@ -11,12 +11,12 @@ module MongoModel
11
11
  false
12
12
  end
13
13
  end
14
-
14
+
15
15
  private
16
16
  def true?(value)
17
17
  TRUE_VALUES.include?(value)
18
18
  end
19
-
19
+
20
20
  def false?(value)
21
21
  FALSE_VALUES.include?(value)
22
22
  end
@@ -6,7 +6,7 @@ module MongoModel
6
6
  def initialize(type)
7
7
  @type = type
8
8
  end
9
-
9
+
10
10
  def cast(value)
11
11
  if value.is_a?(@type)
12
12
  value
@@ -16,7 +16,7 @@ module MongoModel
16
16
  @type.new(value)
17
17
  end
18
18
  end
19
-
19
+
20
20
  def to_mongo(value)
21
21
  if value.respond_to?(:to_mongo)
22
22
  value.to_mongo
@@ -24,7 +24,7 @@ module MongoModel
24
24
  value
25
25
  end
26
26
  end
27
-
27
+
28
28
  def from_mongo(value)
29
29
  if @type.respond_to?(:from_mongo)
30
30
  value = value.with_indifferent_access if value.respond_to?(:with_indifferent_access)
@@ -14,11 +14,11 @@ module MongoModel
14
14
  rescue
15
15
  nil
16
16
  end
17
-
17
+
18
18
  def to_mongo(value)
19
19
  value.strftime("%Y/%m/%d") if value
20
20
  end
21
-
21
+
22
22
  def from_mongo(value)
23
23
  value.to_date if value
24
24
  end
@@ -18,34 +18,24 @@ module MongoModel
18
18
  rescue
19
19
  nil
20
20
  end
21
-
21
+
22
22
  def to_mongo(value)
23
23
  to_time(value.utc) if value
24
24
  end
25
-
25
+
26
26
  def from_mongo(t)
27
27
  ::DateTime.civil(t.year, t.month, t.day, t.hour, t.min, t.sec + Rational(t.usec, 1000000)) if t
28
28
  end
29
-
29
+
30
30
  private
31
31
  # Define our own to_time method as DateTime.to_time in ActiveSupport may return
32
32
  # the DateTime object unchanged, whereas BSON expects an actual Time object.
33
33
  def to_time(dt)
34
- ::Time.utc(dt.year, dt.month, dt.day, dt.hour, dt.min, dt.sec, sec_fraction(dt).to_f * 1000000)
34
+ ::Time.utc(dt.year, dt.month, dt.day, dt.hour, dt.min, dt.sec, dt.sec_fraction.to_f * 1000000)
35
35
  end
36
-
37
- def sec_fraction(dt)
38
- if RUBY_VERSION <= "1.8.7"
39
- # Ruby 1.8.7 DateTime#sec_fraction unit is in days
40
- dt.sec_fraction * 86400
41
- else
42
- dt.sec_fraction
43
- end
44
- end
45
-
36
+
46
37
  def round_microseconds(dt)
47
- seconds = dt.sec + sec_fraction(dt)
48
- dt.change(:sec => Rational((seconds * 1000).round, 1000))
38
+ ::DateTime.civil(dt.year, dt.month, dt.day, dt.hour, dt.min, dt.sec + Rational(dt.sec_fraction).truncate(3))
49
39
  end
50
40
  end
51
41
  end
@@ -8,7 +8,7 @@ module MongoModel
8
8
  Kernel::Float(value) rescue nil
9
9
  end
10
10
  end
11
-
11
+
12
12
  def boolean(value)
13
13
  !value.zero?
14
14
  end
@@ -9,7 +9,7 @@ module MongoModel
9
9
  result
10
10
  } if hash
11
11
  end
12
-
12
+
13
13
  def from_mongo(hash)
14
14
  hash.with_indifferent_access if hash
15
15
  end
@@ -2,20 +2,23 @@ module MongoModel
2
2
  module Types
3
3
  class Integer < Object
4
4
  def cast(value)
5
- if value.nil?
6
- nil
7
- else
8
- begin
9
- Kernel::Integer(value)
10
- rescue ArgumentError
11
- Kernel::Float(value).to_i rescue nil
12
- end
13
- end
5
+ to_integer(value) if value
14
6
  end
15
-
7
+
16
8
  def boolean(value)
17
9
  !value.zero?
18
10
  end
11
+
12
+ def from_mongo(value)
13
+ to_integer(value)
14
+ end
15
+
16
+ private
17
+ def to_integer(value)
18
+ Kernel::Integer(value)
19
+ rescue ArgumentError, TypeError
20
+ Kernel::Float(value).to_i rescue nil
21
+ end
19
22
  end
20
23
  end
21
24
  end
@@ -4,23 +4,23 @@ module MongoModel
4
4
  def cast(value)
5
5
  value
6
6
  end
7
-
7
+
8
8
  def boolean(value)
9
9
  !value.blank?
10
10
  end
11
-
11
+
12
12
  def to_mongo(value)
13
13
  value
14
14
  end
15
-
15
+
16
16
  def from_mongo(value)
17
17
  value
18
18
  end
19
-
19
+
20
20
  def to_query(value)
21
21
  to_mongo(cast(value))
22
22
  end
23
-
23
+
24
24
  protected
25
25
  def convert(value)
26
26
  Types.converter_for(value.class).to_mongo(value)
@@ -19,15 +19,15 @@ module MongoModel
19
19
  end
20
20
  end
21
21
  end
22
-
22
+
23
23
  def from_mongo(value)
24
24
  rational_from_string(value)
25
25
  end
26
-
26
+
27
27
  def to_mongo(value)
28
28
  value.to_s
29
29
  end
30
-
30
+
31
31
  private
32
32
  if RUBY_VERSION >= '1.9.2'
33
33
  def rational_from_string(str)
@@ -22,11 +22,11 @@ module MongoModel
22
22
  rescue
23
23
  nil
24
24
  end
25
-
25
+
26
26
  def to_mongo(value)
27
27
  value.utc if value
28
28
  end
29
-
29
+
30
30
  def from_mongo(value)
31
31
  value.in_time_zone if value
32
32
  end
@@ -1,3 +1,3 @@
1
1
  module MongoModel
2
- VERSION = "0.5.5"
2
+ VERSION = "0.5.6"
3
3
  end
@@ -14,8 +14,7 @@ production:
14
14
  <<: *defaults
15
15
  database: <%= database %>_production
16
16
  # host:
17
- # username:
18
- # password:
19
- # pool_size:
17
+ # username:
18
+ # password:
19
+ # pool_size:
20
20
  # timeout:
21
-