Commit 7e0284a226a9d99ccbf5d1624fd50db4cf497acc
Exists in
staging
and in
15 other branches
Merge branch 'count_distinct_paginate' into 'master'
Count distinct - Multiple fields in paginate Fix sql query error with `distinct` into a **COUNT()** database function with multiple fields. The problem was caused by the gem `will_paginate` on version **3.0.5**. In their new version **3.0.7** this bug was fixed!! See merge request !777
Showing
2 changed files
with
21 additions
and
1 deletions
Show diff stats
Gemfile
... | ... | @@ -18,7 +18,7 @@ gem 'ruby-feedparser', '~> 0.7' |
18 | 18 | gem 'daemons', '~> 1.1' |
19 | 19 | gem 'unicorn', '~> 4.8' |
20 | 20 | gem 'nokogiri', '~> 1.6.0' |
21 | -gem 'will_paginate', '~> 3.0.5.0' | |
21 | +gem 'will_paginate', '~> 3.0.7' | |
22 | 22 | gem 'pothoven-attachment_fu', '~> 3.2.16' |
23 | 23 | gem 'delayed_job' |
24 | 24 | gem 'delayed_job_active_record' | ... | ... |
plugins/relevant_content/test/unit/relevant_content_block_test.rb
... | ... | @@ -57,4 +57,24 @@ class RelevantContentBlockTest < ActiveSupport::TestCase |
57 | 57 | end |
58 | 58 | end |
59 | 59 | |
60 | + should 'check most voted articles from profile with relevant content block' do | |
61 | + community = fast_create(Community) | |
62 | + article = fast_create(Article, {:name=>'2 votes', :profile_id => community.id}) | |
63 | + 2.times{ | |
64 | + person = fast_create(Person) | |
65 | + person.vote_for(article) | |
66 | + } | |
67 | + article = fast_create(Article, {:name=>'10 votes', :profile_id => community.id}) | |
68 | + 10.times{ | |
69 | + person = fast_create(Person) | |
70 | + person.vote_for(article) | |
71 | + } | |
72 | + | |
73 | + Box.create!(owner: community) | |
74 | + community.boxes[0].blocks << RelevantContentPlugin::RelevantContentBlock.new | |
75 | + | |
76 | + data = Article.most_voted(community, 5) | |
77 | + assert_equal false, data.empty? | |
78 | + end | |
79 | + | |
60 | 80 | end | ... | ... |