trendable 1.1.1 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 10f3a8827131008a4a915c22e7679e840b439ed1
4
- data.tar.gz: f26a79b4379659e3884bbb1b99c78199bb8b9d7d
3
+ metadata.gz: 0f3496ff5b5f317e0ac19af1fc510daebab600b9
4
+ data.tar.gz: 235bff5831a602bf1417f74b8157a8ac609bb8b8
5
5
  SHA512:
6
- metadata.gz: 7c072d0a5d6da8d3d1f878ef1a73f3ffcb389ea068c626d2426119812ecacff16df1c6e3e0d22480f4123b18a0e816c40d37d687f03632df18029ad006cdd55d
7
- data.tar.gz: 61c01937bb4c99fcf10851070138b41bff5527b8389f669b56c09de961797f77774adb60aed3797ebaaa0dcca9a8085e52931a07c7c6c319d1e32bf416439fb0
6
+ metadata.gz: 12e94fbaa8060d5fb3cae3464a8837318ba8e2e8f9b85e0bf9e1baae77dd287c773df29dbef8afebff42cd7cebf37fb8750e8ea9ce6395f1c5117785f7317072
7
+ data.tar.gz: bfea558e138bc6ce0b0d61cc8636c70f140999902267bed6d9209b48fef7c736b9a482422057ffa3fc5b4ed247c43afd271eb1542ec2a17b88fa84a961745c43
data/.gitignore CHANGED
@@ -36,6 +36,7 @@ rerun.txt
36
36
  pickle-email-*.html
37
37
  .DS_Store
38
38
  *.swp
39
+ *.gem
39
40
 
40
41
  # Ignore application configuration
41
42
  /config/application.yml
data/README.md CHANGED
@@ -10,6 +10,7 @@ Add management for ordering your models by a trending popularity value.
10
10
 
11
11
  # Add a migration:
12
12
  $ rails g trendable:migration widget
13
+ $ bundle exec rake db:migrate
13
14
 
14
15
  # Update your model to include the concern
15
16
  # app/models/widget.rb
@@ -24,4 +25,10 @@ Add management for ordering your models by a trending popularity value.
24
25
 
25
26
  20.times{ Widget.first.fade_trending_power }
26
27
 
27
- Widget.order_by_trending
28
+ Widget.order_by_trending
29
+
30
+ You can use the `FadeOutTrendPowerWorker` to lower the trending power over time.
31
+
32
+ For example, you might run it once an hour to fade out the power of the widget. In this way, the more recent the boost, the more trending power.
33
+
34
+ Note that the `FadeOutTrendingPowerWorker` does not hit any callbacks. It's an `update_all` on the table (for performance).
@@ -1,5 +1,5 @@
1
1
  module Trendable
2
2
  module Rails
3
- VERSION = "1.1.1"
3
+ VERSION = "1.2.0"
4
4
  end
5
5
  end
@@ -6,10 +6,8 @@ class FadeOutTrendPowerWorker
6
6
 
7
7
  ActiveRecord::Base.descendants.each do |klass|
8
8
  if klass.respond_to?( "has_trendable_concern?".to_sym )
9
- klass.all.each do |inst|
10
- # TODO: Replace with some kind of update_all
11
- inst.fade_out_trending_power!( multiplier )
12
- end
9
+
10
+ klass.update_all( "trending_power = trending_power * #{multiplier}")
13
11
  else
14
12
  puts "#{klass.to_s} does not have trendable concern"
15
13
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: trendable
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.1
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeff McFadden