Skip to content
Browse files

Risky::Indexes converts values to strings correctly.

  • Loading branch information...
1 parent 75646e7 commit 7fe5b949d8437bb021897645fc288912b3cd7165 Kyle Kingsbury committed Apr 25, 2011
Showing with 3 additions and 2 deletions.
  1. +3 −2 lib/risky/indexes.rb
View
5 lib/risky/indexes.rb
@@ -25,7 +25,7 @@ def self.by_#{attribute}(value)
from_riak_object(
Riak::RObject.new(
riak[#{opts[:bucket].inspect}],
- value
+ value.to_s
).walk(:bucket => #{@bucket_name.inspect}).first.first
)
rescue Riak::FailedRequest => e
@@ -59,6 +59,7 @@ def after_save
current = opts[:proc][self] rescue self[attr.to_s]
old = @old_indexed_values[attr]
@old_indexed_values[attr] = current
+
unless old == current
# Remove old index
if old
@@ -67,7 +68,7 @@ def after_save
# Create new index
unless current.nil?
- index = Riak::RObject.new(self.class.riak[opts[:bucket]], current)
+ index = Riak::RObject.new(self.class.riak[opts[:bucket]], current.to_s)
index.content_type = 'text/plain'
index.data = ''
index.links = Set.new([@riak_object.to_link('value')])

0 comments on commit 7fe5b94

Please sign in to comment.
Something went wrong with that request. Please try again.