Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Add 1.8 hash syntax back. I don't want a major version bump yet.

Signed-off-by: David Celis <me@davidcel.is>
  • Loading branch information...
commit eec116105e1572346d271609518f37f5d76b5721 1 parent 2f698f6
David Celis authored
4 lib/recommendable/ratable.rb
View
@@ -47,10 +47,10 @@ def rated?
# @return [Array] the top items belonging to this class, sorted by score
def self.top(options = {})
if options.is_a?(Integer)
- options = { count: options}
+ options = { :count => options}
warn "[DEPRECATION] Recommenable::Ratable.top now takes an options hash. Please call `.top(count: #{options[:count]})` instead of just `.top(#{options[:count]})`"
end
- options.reverse_merge!(count: 1, offset: 0)
+ options.reverse_merge!(:count => 1, :offset => 0)
score_set = Recommendable::Helpers::RedisKeyMapper.score_set_for(self)
ids = Recommendable.redis.zrevrange(score_set, options[:offset], options[:offset] + options[:count] - 1)
6 test/recommendable/ratable_test.rb
View
@@ -61,7 +61,7 @@ def test_top_scope_returns_best_things
@user.like(@book3)
@user.dislike(@book)
- top = Book.top(count: 3)
+ top = Book.top(:count => 3)
assert_equal top[0], @book2
assert_equal top[1], @book3
assert_equal top[2], @book
@@ -78,7 +78,7 @@ def test_top_scope_returns_best_things_for_ratable_base_class
@user.like(@movie2)
@user.dislike(@movie)
- top = Movie.top(count: 3)
+ top = Movie.top(:count => 3)
assert_equal top[0], @doc
assert_equal top[1], @movie2
assert_equal top[2], @movie
@@ -95,7 +95,7 @@ def test_top_scope_returns_best_things_with_start
@user.like(@movie2)
@user.dislike(@movie)
- top = Movie.top(count: 2, offset: 1)
+ top = Movie.top(:count =>2, :offset => 1)
assert_equal top[0], @movie2
assert_equal top[1], @movie
end
Please sign in to comment.
Something went wrong with that request. Please try again.