Permalink
Browse files

Fix bugs with globalize, published_before and clean code

Fixes #276
  • Loading branch information...
1 parent e4901f3 commit f6dbe316f9f793369029db51efe695ec9766c6c1 @keram keram committed with parndt Aug 29, 2012
Showing with 7 additions and 7 deletions.
  1. +2 −2 app/controllers/refinery/blog/posts_controller.rb
  2. +5 −5 app/models/refinery/blog/post.rb
@@ -10,7 +10,7 @@ class PostsController < BlogController
def index
# Rss feeders are greedy. Let's give them every blog post instead of paginating.
- (@posts = Post.live.includes(:comments, :categories).with_globalize) if request.format.rss?
+ (@posts = Post.live.includes(:comments, :categories)) if request.format.rss?
respond_with (@posts) do |format|
format.html
format.rss { render :layout => false }
@@ -71,7 +71,7 @@ def archive
def tagged
@tag = ActsAsTaggableOn::Tag.find(params[:tag_id])
@tag_name = @tag.name
- @posts = Post.tagged_with(@tag_name).with_globalize.page(params[:page])
+ @posts = Post.live.tagged_with(@tag_name).page(params[:page])
end
protected
@@ -87,7 +87,7 @@ def find_by_slug_or_id(slug_or_id)
end
def by_month(date)
- where(:published_at => date.beginning_of_month..date.end_of_month).with_globalize
+ where(:published_at => date.beginning_of_month..date.end_of_month)
end
def by_archive(date)
@@ -100,23 +100,23 @@ def by_year(date)
end
def published_dates_older_than(date)
- published_before(date).with_globalize.pluck(:published_at)
+ published_before(date).pluck(:published_at)
end
def recent(count)
- live.limit(count).with_globalize
+ live.limit(count)
end
def popular(count)
unscoped.order("access_count DESC").limit(count).with_globalize
end
def previous(item)
- published_before(item.published_at).with_globalize.first
+ published_before(item.published_at).first
end
def uncategorized
- live.includes(:categories).where(Refinery::Categorization.table_name => { :blog_category_id => nil }).with_globalize
+ live.includes(:categories).where(Refinery::Categorization.table_name => { :blog_category_id => nil })
end
def next(current_record)

0 comments on commit f6dbe31

Please sign in to comment.