Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Better backward compatibility for applications mixing string based an…

…d keyword based hashed for data serialization logic (e.g. Apply)
  • Loading branch information...
commit 77c87c50cf565c66feeaa1a5d97852f885d1ff19 1 parent f323aa8
@braintreeps braintreeps authored
Showing with 3 additions and 3 deletions.
  1. +2 −2 lib/curator/repository.rb
  2. +1 −1  spec/curator/repository_spec.rb
View
4 lib/curator/repository.rb
@@ -90,7 +90,7 @@ def save_without_timestamps(object)
end
def serialize(object)
- object.instance_values
+ HashWithIndifferentAccess.new(object.instance_values)
end
def _build_finder_methods(attribute)
@@ -133,7 +133,7 @@ def _indexed_fields
end
def _indexes(object)
- index_values = _indexed_fields.map { |field| [field, _serialize(object)[field.to_s]] }
+ index_values = _indexed_fields.map { |field| [field, serialize(object)[field.to_sym]] }
index_values += [
[:created_at, _format_time_for_index(object.send(:created_at))],
[:updated_at, _format_time_for_index(object.send(:updated_at))],
View
2  spec/curator/repository_spec.rb
@@ -117,7 +117,7 @@
def self.serialize(model)
super.tap do |attributes|
- attributes["multiple_values"] = model.multiple_values.to_a
+ attributes[:multiple_values] = model.multiple_values.to_a
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.