Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #30 from HungYuHei/redis-init

Now can init redis with url or redis instance
  • Loading branch information...
commit 30ab62d79703e949724f83e70aba061368a3c2d1 2 parents a3d031d + d3217a9
@erwaller erwaller authored
Showing with 16 additions and 3 deletions.
  1. +8 −0 README.markdown
  2. +8 −3 lib/soulmate.rb
View
8 README.markdown
@@ -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
11 lib/soulmate.rb
@@ -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
Please sign in to comment.
Something went wrong with that request. Please try again.