Permalink
Browse files

fix bugs with globalize, published_before and clean code

  • Loading branch information...
1 parent 06fe63e commit a8cce8471a61d035d9b563e0efd4dede7b14a571 @keram keram committed 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).page(params[:page])
+ @posts = Post.live.tagged_with(@tag_name).page(params[:page])
end
protected
@@ -86,7 +86,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)
@@ -99,23 +99,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 a8cce84

Please sign in to comment.