Permalink
Browse files

now can init redis with url or redis instance

  • Loading branch information...
1 parent 05a3907 commit d3217a93d235912b65f2daaa5ac3baa9ea17df77 @HungYuHei HungYuHei committed Feb 4, 2013
Showing with 16 additions and 3 deletions.
  1. +8 −0 README.markdown
  2. +8 −3 lib/soulmate.rb
View
@@ -110,6 +110,14 @@ Add this to gemfile:
Then you can query soulmate at the /sm url, for example: http://localhost:3000/sm/search?types[]=venues&limit=6&term=kitten
+You can also config your redis instance:
+
+ # config/initializers/soulmate.rb
+
+ Soulmate.redis = 'redis://127.0.0.1:6379/0'
+ # or you can asign an existing instance of Redis, Redis::Namespace, etc.
+ # Soulmate.redis = $redis
+
### Rendering an autocompleter
Soulmate doesn't include any client-side code necessary to render an autocompleter, but Mitch Crowe put together a pretty cool looking jquery plugin designed for exactly that: <a href="https://github.com/mcrowe/soulmate.js">soulmate.js</a>.
View
@@ -15,9 +15,14 @@ module Soulmate
MIN_COMPLETE = 2
DEFAULT_STOP_WORDS = ["vs", "at", "the"]
- def redis=(url)
- @redis = nil
- @redis_url = url
+ def redis=(server)
+ if server.is_a?(String)
+ @redis = nil
+ @redis_url = server
+ else
+ @redis = server
+ end
+
redis
end

0 comments on commit d3217a9

Please sign in to comment.