Commit 49d1e301527f80ca8573c112f1c6f5cbd730e0d5
1 parent
70ff8448
Exists in
master
and in
29 other branches
rails3: fix blog_archives_block
Showing
1 changed file
with
3 additions
and
2 deletions
Show diff stats
app/models/blog_archives_block.rb
... | ... | @@ -2,6 +2,7 @@ class BlogArchivesBlock < Block |
2 | 2 | |
3 | 3 | include ActionView::Helpers::TagHelper |
4 | 4 | include ActionView::Helpers::UrlHelper |
5 | + include ActionView::Helpers | |
5 | 6 | include Rails.application.routes.url_helpers |
6 | 7 | include ActionView::Helpers::AssetTagHelper |
7 | 8 | include DatesHelper |
... | ... | @@ -31,10 +32,10 @@ class BlogArchivesBlock < Block |
31 | 32 | return nil unless owner_blog |
32 | 33 | results = '' |
33 | 34 | posts = visible_posts(args[:person]) |
34 | - posts.count(:all, :group => 'EXTRACT(YEAR FROM published_at)').sort_by {|year, count| -year.to_i}.each do |year, count| | |
35 | + posts.except(:order).count(:all, :group => 'EXTRACT(YEAR FROM published_at)').sort_by {|year, count| -year.to_i}.each do |year, count| | |
35 | 36 | results << content_tag('li', content_tag('strong', "#{year} (#{count})")) |
36 | 37 | results << "<ul class='#{year}-archive'>" |
37 | - posts.count(:all, :conditions => ['EXTRACT(YEAR FROM published_at)=?', year], :group => 'EXTRACT(MONTH FROM published_at)').sort_by {|month, count| -month.to_i}.each do |month, count| | |
38 | + posts.except(:order).count(:all, :conditions => ['EXTRACT(YEAR FROM published_at)=?', year], :group => 'EXTRACT(MONTH FROM published_at)').sort_by {|month, count| -month.to_i}.each do |month, count| | |
38 | 39 | month_name = gettext(MONTHS[month.to_i - 1]) |
39 | 40 | results << content_tag('li', link_to("#{month_name} (#{count})", owner_blog.url.merge(:year => year, :month => month))) |
40 | 41 | end | ... | ... |