likes_tracker 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
data/.travis.yml ADDED
@@ -0,0 +1,4 @@
1
+ language: ruby
2
+ rvm:
3
+ - 1.9.3
4
+ - 1.9.2
data/Gemfile CHANGED
@@ -6,6 +6,6 @@ gemspec
6
6
  group :development, :test do
7
7
  gem 'simplecov', require: false
8
8
  gem 'sqlite3'
9
- gem 'rspec-rails', '~> 2.10.0'
9
+ gem 'rspec-rails', '~> 2.11.0'
10
10
  gem 'factory_girl_rails', '~> 3.5.0'
11
11
  end
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # LikesTracker
1
+ # LikesTracker [![Build Status](https://secure.travis-ci.org/apeacox/likes_tracker.png)](http://travis-ci.org/apeacox/likes_tracker)
2
2
 
3
3
  A Rails gem to track *likes* between two ```ActiveModel``` compliant models. A common use case might be that a User likes a Post.
4
4
 
@@ -122,7 +122,7 @@ Last but not least, here there're the remaining methods and examples:
122
122
 
123
123
  ## Contributing
124
124
 
125
- 1. Fork it
125
+ 1. Fork it!
126
126
  2. Create your feature branch (`git checkout -b my-new-feature`)
127
127
  3. Commit your changes (`git commit -am 'Added some feature'`)
128
128
  4. Push to the branch (`git push origin my-new-feature`)
data/lib/likes_tracker.rb CHANGED
@@ -74,7 +74,7 @@ module LikesTracker
74
74
  blk = ->(klass, params) { block.call(klass, params) }
75
75
  blk.call(self, most_liked_ids)
76
76
  else
77
- self.where(id: most_liked_ids)
77
+ self.where(id: most_liked_ids).order(most_liked_ids.map {|id| "id = #{id} DESC"}.join(','))
78
78
  end
79
79
  end
80
80
 
@@ -1,3 +1,3 @@
1
1
  module LikesTracker
2
- VERSION = "0.0.4"
2
+ VERSION = '0.0.5'
3
3
  end
@@ -1,4 +1,7 @@
1
1
  require 'redis'
2
2
 
3
- $redis = Redis.new(host: 'localhost', port: '6379', db: '1')
4
-
3
+ $redis = Redis.new(
4
+ host: (ENV['REDIS_HOST'] || 'localhost'),
5
+ port: (ENV['REDIS_PORT'] || '6379'),
6
+ db: (ENV['REDIS_DB'] || '2')
7
+ )
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: likes_tracker
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-07-27 00:00:00.000000000 Z
12
+ date: 2012-09-06 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
@@ -83,6 +83,7 @@ extensions: []
83
83
  extra_rdoc_files: []
84
84
  files:
85
85
  - .gitignore
86
+ - .travis.yml
86
87
  - Gemfile
87
88
  - LICENSE
88
89
  - README.md
@@ -191,3 +192,4 @@ test_files:
191
192
  - spec/likes_tracker_spec.rb
192
193
  - spec/spec_helper.rb
193
194
  - spec/support/factories.rb
195
+ has_rdoc: